0
Good morning, I have a registration screen, a jsp
with a modal where I implemented a picklist based on Bootstrap templates.
I need to select from my bank the companies (are doing this) on one side and move to the other side the selected ones (which does not), see image.
BoxApp.controller("CadastroCertificadoController", function($scope, $http) {
$scope.clientes = {};
$scope.iniciar = function() {
$http.get('/boxmlV2/cadastrocertificado').success(function(response) {
$scope.clientes = response;
});
};
$scope.iniciar();
});
My Component picklist in jsp:
<div class="form-group">
<label class="control-label col-md-3">Empresas:</label>
<div class="col-md-9">
<select ng-model="certificadoIncluirAlterar.razaoSocial" multiple="multiple" class="multi-select" id="my_multi_select1" name="my_multi_select1[]">
<option ng-repeat="c in clientes" value="{{c.idCliente}}">{{c.razaoSocial}}</option>
</select>
</div>
</div>
My Java Controller (only loads client table data on screen):
@Controller
public class CadastroCertificadoController {
@Autowired
private ClienteService clienteService;
@RequestMapping(value = "/cadastrocertificado", method = RequestMethod.GET)
public ModelAndView iniciar(ModelMap modelMap) {
return new ModelAndView("cadastrocertificado");
}
@RequestMapping(value="/cadastrocertificado", method=RequestMethod.GET, produces={"application/json"})
public @ResponseBody List<ClienteDTO> obterTodos(ModelMap modelMap){
return clienteService.obterTodos();
}
}
I don’t know what might be going on, any help is valid. Thank you.
Mocked data, works this way:
<select ng-model="certificadoIncluirAlterar.razaoSocial" multiple="multiple" class="multi-select"
id="my_multi_select1" name="my_multi_select1[]">
<option>Teste 1 </option>
<option>Teste 2 </option>
<option>Teste 3 </option>
<option>Teste 4 </option>
<option>Teste 5 </option>
<option>Teste</option> <
<option selected>Teste 6</option>
<option selected>Teste 7</option>
</select>
How are you doing the function to grab from the left column and play right? It’s by Angular or some bootstrap JS (or js)?
– celsomtrindade
Celsom, I’m new to Angular and js actually, this is exactly what I want to do. I can only mock the data, I have no idea how to pass the data to the other side. I edited the question with the example with the mocked data, ai works but you can see that it is a tag that defines what went to the other side.
– Leonardo Leonardo
In fact, just playing to the other side, is simple. But, before elaborating the answer, a question, what is the purpose? Will you register in a bank later? Do you need to go with more data? Or just the list of companies? Or.. will be only one company or may be multiple companies?
– celsomtrindade
This Celsom, the records (list) that will be passed to the right side (selected) will be sent to the java controller where I will save in the database. You need to go with the company id and the social reason, I need the id to enter in the bank. Thank you !
– Leonardo Leonardo