gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

Drop down option list does not change when new populate (via JSON) is called #321

Open SentencedToCode opened 9 years ago

SentencedToCode commented 9 years ago

Can someone show me some sample code on how to repopulate the drop down option list on selecBoxIt control? This list populates perfectly from a JSON object, but when I remove, populate, refresh, I am left with an empty list: $("#selSM4").data("selectBox-selectBoxIt").remove(); $("#selSM4").selectBoxIt({ populate: function () { var deferred = $.Deferred(), arr = [], x = -1; $.ajax({ url: 'http://localhost:58933/home/AllSchoolList?subject' }).done(function (data) { while (++x < data.length) { arr.push({text: data[x].name, value: data[x].value, }); } deferred.resolve(arr); }); return deferred; } }); $("#selSM4").data("selectBox-selectBoxIt").refresh(); The "populate" works initially. Why not when i try to "populate" with a different list?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.