I am writing to report a bug… I believe jqxData is to blame, but it might be in jqxcore. Sorry if this is already known… And I’m sorry but I cannot reveal my code and I don’t have time to create a jsfiddle, but a quick glance at the code base and you will see it is obvious.
1. See the jqxGrid “columns” definition below
2. optionsDataAdapter is set to bind to JSON via URL
3. when a row is edited, dropdownlist will be created correctly but FIRES THREE AJAX REQUESTS
4. if I switch the order of the properties being sent to jqxDropDownList, only ONE request is sent!! Yes, the order matters.
There is a jQuery $.each() being used to iterate across the properties, but there is no check to make sure that the “source” property is processed last. So when the “displayMember” is changed, it fires an event that reloads the data, sending an additional request. Same goes for “valueMember”. So that makes THREE requests total.
The workaround is obvious — just make sure the “source” property comes AFTER the “displayMember” and “valueMember” properties. But this is certainly NOT intuitive. The config object should be processed correctly.
ver: 3.7.0
columns: [
{
text: 'Sample Column',
datafield: 'sample_id',
displayfield: 'sample_label',
columntype: 'dropdownlist',
createeditor: function (row, cellvalue, $editor, celltext, cellwidth, cellheight)
{
$editor.jqxDropDownList({
source: optionsDataAdapter, // if "source" comes before "displayMember" or "valueMember", multiple req's will be sent
displayMember: 'name',
valueMember: 'id',
dropDownWidth: 200
});
}
}
]