Reputation: 1
I have this simple javascript code that get spListItems from SharePoint using REST and populates a dropdown list. I want to apply some bootstap style on it once the dropdown is populated. How can i determine that the population of dropdown is done/finsihed. so that I can apply style on the dropdown items.
function populateDropDown(dropdownId, spList) {
var url = "http://devportal/FormsRepository/_vti_bin/ListData.svc/" + spList;
var dropdownControl = $('#' + dropdownId);
$.getJSON(url, function (data) {
$.each(data.d.results, function (key, value) {
dropdownControl.append(
$('<option></option>').val(key).html(value.Title)
);
});
});
}
//this lines does work properly as the dropdown is not populated yet
$('.combobox').combobox();
Your time and help would be much appreciated. Cheers
Upvotes: 0
Views: 347
Reputation: 877
Why not place
$('.combobox').combobox();
after the $.each loop?
Upvotes: 3