New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestions don't appear in dropdown, when loading from remote source #683
Comments
Can you give an excerpt of your data? |
I also have this issue, this is my code:
}); end these are the data that I retrieve via ajax: {"response":{"section":{"_id":"21","_handle":"ricambi","value":"Ricambi"},"entry":[{"_id":"34433","_immagini":"1","_articoli":"0","code":{"_handle":"ft-111144","value":"FT-111144"}},{"_id":"34366","_immagini":"1","_articoli":"0","code":{"_handle":"941111","value":"941111"}},{"_id":"34365","_immagini":"1","_articoli":"0","code":{"_handle":"941110","value":"941110"}},{"_id":"34285","_immagini":"1","_articoli":"0","code":{"_handle":"850111","value":"850111"}},{"_id":"34252","_immagini":"1","_articoli":"0","code":{"_handle":"811115","value":"811115"}},{"_id":"34251","_immagini":"1","_articoli":"0","code":{"_handle":"811114","value":"811114"}},{"_id":"34250","_immagini":"1","_articoli":"0","code":{"_handle":"811113","value":"811113"}},{"_id":"34249","_immagini":"1","_articoli":"0","code":{"_handle":"811110","value":"811110"}},{"_id":"34248","_immagini":"1","_articoli":"0","code":{"_handle":"811108","value":"811108"}},{"_id":"34247","_immagini":"1","_articoli":"0","code":{"_handle":"811106","value":"811106"}},{"_id":"34246","_immagini":"1","_articoli":"0","code":{"_handle":"811105","value":"811105"}},{"_id":"34245","_immagini":"1","_articoli":"0","code":{"_handle":"811104","value":"811104"}},{"_id":"34184","_immagini":"1","_articoli":"0","code":{"_handle":"211107","value":"211107"}},{"_id":"34183","_immagini":"1","_articoli":"0","code":{"_handle":"211106","value":"211106"}},{"_id":"34182","_immagini":"1","_articoli":"0","code":{"_handle":"211105","value":"211105"}},{"_id":"34181","_immagini":"1","_articoli":"0","code":{"_handle":"211104","value":"211104"}},{"_id":"34180","_immagini":"1","_articoli":"0","code":{"_handle":"211103","value":"211103"}},{"_id":"34179","_immagini":"1","_articoli":"0","code":{"_handle":"211102","value":"211102"}},{"_id":"34178","_immagini":"1","_articoli":"0","code":{"_handle":"211101","value":"211101"}},{"_id":"34059","_immagini":"1","_articoli":"0","code":{"_handle":"182111","value":"182111"}}]}} |
@DaveRev In your case, selectize doesn't support accessing nested values with dot notation. You'll have to do something along the lines of this in your callback(theJson.response.entry.slice(0,4).map(function(item) {
return {
_id: item._id,
_immagini: item._immagini,
_articoli: item._articoli,
_handle: item.code._handle,
value: item.code.value
};
}); |
Thanks for the quick reply, it works, but I'm getting an issue when I select an item. The select tag don't get the value of the item that I choose, also changing the option of selectize like this: valueField: 'value', So when I submit the form, select hasn't got value. How can I solve this? |
Sorry, I found the issue, there was another instance of selectize working on the same select tag. |
@Saeven same problem here, same code |
Same issue, but here's a simplified example (no API required) — $input.selectize({
options: [],
create: false,
delimiter: ',',
valueField: 'key',
labelField: 'value',
load: function (query, callback) {
callback([
{key: 1, value: 'One'},
{key: 2, value: 'Two'},
{key: 3, value: 'Three'},
{key: 4, value: 'Four'},
{key: 5, value: 'Five'},
]);
}
}); To reproduce:
Using v0.12.0 |
Oh, shoot ok I found my problem (which might be the same as the OP). I just needed to specify a |
@donmccurdy That is it. Thank you! |
Facing the same issue, replaced a new API but 100% the same format. The dropdown just wont bloody appear until i click outside and back into the dropdownlist again |
Have you specified |
✅ Work Well for Ajax (remote data) , Json , Rails, item dropdown , Selectize Vs Select2 ?Finally, job done and work fine with Select2 🤷🏽♂️ if need the access repo tell me bye |
As others have alluded to the issues lies with a poorly configured
var query = $.trim(self.$control_input.val());
var results = self.search(query); So what happens is AJAX returns 10 results, Personally I wouldn't expect this extra filtering step; I'd just expect it to display the AJAX results. |
100% on the poorly configured So, in effect, since the internal product code doesn't exist in the returned name text, it doesn't show anything because selectize is filtering again by the search param. I ended up including the internal product code in the final text display and that served as a good workaround ( |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
I configured a field like so:
However, though the query succeeds, no dropdown appears. If I mouse out, and then back in, the dropdown appears with the proper search results in it.
When the original search occurs, line 2110 in the standalone build,
Returns that results.items.length is zero, though results were clearly returned.
The text was updated successfully, but these errors were encountered: