jQuery UI Widgets › Forums › Grid › Keep old json object when selecting row
Tagged: child objects, data adapter, dataadapter, getrowdata, jqxDataAdapter, jqxgrid, loadedData, map, original data
This topic contains 5 replies, has 2 voices, and was last updated by maniac_1979 10 years, 11 months ago.
-
Author
-
Hi All,
I have a problem with the selected row item in jqxgrid.
See this fiddle: http://jsfiddle.net/maniac_1979/e3bxoq5c/2/The problem here is that I would like to have the original json object with child object(s), not the mapped objects that seem to come from the grid.
Is there a possibility to achieve this?
Thank you,
Regards,
Hello maniac_1979,
The “unmapped” data is stored in studiesDataAdapter.loadedData. You can get the original record like so:
buttonclick: function(row) { var originalRowData = studiesDataAdapter.loadedData[row]; console.log(originalRowData); }Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you!
Exactly what I was looking for!Does the same thing count for selecting a row?
Example:
$('#studiesGrid').jqxGrid({ source: studiesDataAdapter, columns: [ { text: "Description", datafield: 'Description' }, { text: 'Duration', datafield: 'Duration' }, { text: 'Code', datafield: 'Code' }, ] }); $("#studiesGrid").on("rowselect", function (row) { var x = studiesDataAdapter.loadedData[row]; console.log(x);when looking in the console it shows x: undefined.
Thanks,
Hi maniac_1979,
The parameter of the rowselect event handler function contains the whole event data, not only the row index. You need to change your code as follows:
$("#studiesGrid").on("rowselect", function(event) { var row = event.args.rowindex; var x = studiesDataAdapter.loadedData[row]; console.log(x); });Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you!
Excellent -
AuthorPosts
You must be logged in to reply to this topic.