In my application, I use JQGrid for loading some contacts data, and when I edit/add an entry I select the contact's name from database and then update/add contact.
My problem is that, when I click the submit button I want to refresh the dropdown and the data that has been already entered to dispaear from dropdown list.
My code:
for colModel:
{ name: 'OwnerEmail', index: 'OwnerEmail', width: 200, align: "center", sortable: true, sorttype: 'text', editable: true, edittype: 'select', editrules: { required: true }, editoptions: { value: ownersList} },
I populate the dropdown on select row (that when I select a row, the dropdown will be refreshed)
onSelectRow: function (id) {
var advOwners = $.ajax({
type: 'POST',
data: {},
url: 'MyWebService.asmx/GetOwners',
async: false,
error: function () {
alert('An error has occured retrieving Owners!');
}
}).responseXML;
var aux = advOwners.getElementsByTagName("string");
ownersList = "";
for (var i = 0; i < aux.length; i++) {
ownersList += aux[i].childNodes[0].nodeValue + ':' + aux[i].childNodes[0].nodeValue + '; ';
}
ownersList = ownersList.substring(0, ownersList.length - 2);
jQuery("#GridView").setColProp('OwnerEmail', { editoptions: { value: ownersList} });
}
But when I enter the edit/add form again, the dropdown it's not refreshed, it has the items that has been loaded in the first place.
Any help?
Thanks, Jeff
See Question&Answers more detail:os