jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Custom Lookup and Full Row Edit error
Tagged: datagrid batch editing
This topic contains 3 replies, has 2 voices, and was last updated by Klaus H 11 years, 5 months ago.
-
Author
-
Hi,
I updated my project to the new jqwidgets version 3.1.0 and stumbled upon an error/bug/different behaviour as before.
I use a lot of foreign key lookups as in your example “Custom DropDownList Column”. I wanted to combine that with the new “Full Row Edit” feature. That leads to an error. The id value of the dropdown list that is passed to the updaterow method is not the id from the dropdown list, but is according to the browser console an object that includes the id and the label of the selected dropdown entry.
I have built an easy example out of the existing examples mentioned above:
$(document).ready(function () { var countries = [ { value: "AF", label: "Afghanistan" }, { value: "AL", label: "Albania" }, { value: "US", label: "United States" } ]; var countriesSource = { datatype: "array", datafields: [ { name: 'label', type: 'string' }, { name: 'value', type: 'string' } ], localdata: countries }; var countriesAdapter = new $.jqx.dataAdapter(countriesSource, { autoBind: true }); var gridSource = { updaterow: function (rowid, rowdata, commit) { console.log(rowdata); commit(true); }, datatype: "array", localdata: [ { countryCode: "US", id: 1, name: "test" } ], datafields: [ { name: 'id', type: 'number'}, { name: 'name', type: 'string'}, { name: 'Country', value: 'countryCode', values: { source: countriesAdapter.records, value: 'value', name: 'label' } }, { name: 'countryCode', type: 'string'} ] }; var gridAdapter = new $.jqx.dataAdapter(gridSource); $("#jqxgrid").jqxGrid( { width: 400, source: gridAdapter, selectionmode: 'singlecell', autoheight: true, editable: true, editmode: 'selectedrow', columns: [ { text: 'ID', datafield: 'id' }, { text: 'Name', datafield: 'name' }, { text: 'Country', datafield: 'countryCode', displayfield: 'Country', columntype: 'dropdownlist', createeditor: function (row, value, editor) { editor.jqxDropDownList({ source: countriesAdapter, displayMember: 'label', valueMember: 'value' }); } } ] }); });
If you remove the line with editmode: ‘selectedrow’ it works correctly, otherwise you get the object instead of the id and the other column (in this case Country) still has the old value, so that one is not updated either.
Hi Klaus,
Thank you for the feedback!
We will investigate the reported behavior and will add a work item, if we confirm it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Klaus,
The issue regarding the “full row edit” with foreign column feature is confirmed. A fix will be available in jQWidgets ver. 3.1.1.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hello Peter,
thank you for the quick response.
-
AuthorPosts
You must be logged in to reply to this topic.