1
I’m using the Lect2 4.0.0 and I am having trouble changing the way the message is shown which indicates not having found results. In the old version used formatNoMatches
to change the presentation, how is it done now?
BS: I cannot change this directly in the file en.BR.js because every select
has a different behavior.
$('#id_categoria').select2(
{
placeholder:'Selecione',
minimumInputLength: 2,
formatNoMatches: function(term) {
return "Nenhum resultado. Adicionar " + term + "?";
}
}
);
This really works, however it is not returning HTML code, know how to solve it? The idea would be to return one
return "Nenhum resultado. <span class='add'>Adicionar <b>" + term + "</b></span>?";
– Paulo
I edited the answer to return HTML... just return a jQuery object:
$("<span>what ever</span>")
– Miguel Angelo
@Orion your idea is to return the "term" to later send it in post to save right ?
– Rod
@Exact rod, by clicking add I will catch the
term
and save via Ajax, and add toselect
.– Paulo
@Orion and where will you leave the button to send the post? rs (I’m also in need of something like kk)
– Rod
@Miguelangelo I opened a question in the Lect2 repository to see if there is a simpler solution for this, I had searched but found nothing in the documentation. It was right to have an option to do this by default.
– Paulo
@Rod by clicking on
span
I’ll pick up the typed text and add to theselect
.– Paulo