Items not reaching render after success of load function
This is my code: $("#my_search_box").selectize({ "onChange": refreshAdminMailSuggest, "valueField": "title", "labelField": "title", "searchField": "title", "options": [], "create": false,
"render": {
option: function(item, escape) {
console.log(item);
return (
"<div>" +
"<span class='title'>" +
"<span class='name'>" + escape(item.title) + "</span>" +
"</span>" +
"</div>"
);
}
},
load: function(query, callback) {
if (query.length < 2) {
return callback();
}
$.ajax({
"url": "/maintain/mailbox/admin-mail-suggest",
"type": "POST",
"data": {
"item": "admin_mail_box",
"str": query
},
"dataType": "json",
error: function() {
callback();
},
success: function(res) {
console.log(res);
callback(res);
}
});
},
});
And i am getting data as below after the success of load function: { "title" : "maruthi" }
However, the console.log(item) is not printing anything.
I just stumbled upon #200 and #509 . But that doesn't seem to be the same issue as this. @brianreavis : can you please provide me the quick solution? as this is urgent for me..
Is anyone out there who can provide the solution for this??
Can we wait for the answer and rely on this?! please reply. It is urgent for me..
Selectize expects an array of options, not a single item.
Thanks @brianreavis . That worked. And one more question.. When an option is selected, how to get the value of the group to which that selected option belongs to?
closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.