samedi 29 novembre 2014

selectize.js - Unable to search for integer values


I just integrated the selectize.js plugin, using the ajax results. This is my init config:



$('#user_select').selectize({
valueField: 'id',
labelField: 'fullname',
searchField: 'fullname',
delimiter: ',',
plugins: ['remove_button'],
render: {
option: function(item, escape) {
return '<div>' + escape( item.firstname + ' ' + item.lastname + ' (' + item.id + ')' ) + '</span></div>';
}
},
load: function(query, callback) {
if (!query.length) return callback();
$.ajax({
url: '...',
type: 'GET',
dataType: 'json',
data: {
search: query
},
error: function() {
callback();
},
success: function(res) {
callback( res.data );
}
});
}
});


Searching for complete strings or strings in combination with integers is no problem. Also the field value is correctly set.


But if I search only for integer values, the ajax gets started, the success action is being loaded correctly and the response data is being delivered to the callback function. Thereafter: no reaction at all. The ajax response itself is completely correct.


I already checked the documentation a few times, but I'm not able to find something. Is this maybe a bug? Do I miss an option somewhere?





Aucun commentaire:

Enregistrer un commentaire