1
Using the Select2 plugin via json I can’t select any results. When you select it does not display the result. I am doing something wrong?
$(".PessoaTipo").select2({
language: "pt-BR",
placeholder: "Pessoa Tipo",
allowClear: true,
minimumInputLength: 0,
ajax:{
url: base_url("system_data/pessoaTipo"),
type: "post",
dataType: "json",
delay: 150,
data: function(params){
return{
text: params.term
};
},
processResults: function(data, params){
params.page = params.page || 1;
return{
results: data,
pagination:{
more: (params.page * 30) < data.total_count
}
};
},
cache: true
}
});
<label class="lbPessoaTipo">Tipo</lab[![inserir a descrição da imagem aqui][1]][1]el>
<div class="select2 PessoaTipo"></div>
I have two answers about. See: http://answall.com/questions/59727/como-deixar-a-primeira-op%C3%A7%C3%A3o-disabled-e-selected/59747#59747 and http://answall.com/questions/112747/select2-presentr-valor-do-optoptgroup-option-concatenated/112775#112775. Your error is here
<div class="select2 PessoaTipo"></div>
. Instead of applying in Apply div on a select that is already loaded.– Marconi
I switched from div to select. It worked. Tnks!
– Rafael L Ramon
Glad I could help :).
– Marconi