1
votes

I'm just a newbie to jqGrid, creating some client side page with jqGrid to present and edit data (datatype:'local'). I use inline editing mode and cellsubmit:'clientArray'. I can edit fields and click enter to exit editing mode.

I'd like to retrieve the data on UI grid via following way:

var obj = $("#myGrid").jqGrid('getGridParam','data');

unfortunately the variable (an array) is not updated with my changes.

however, based on info here, if i call getRowData(rowId), i can get the updated data successfully. Is it a bug? or should I call some other method to submit the data so that i can retrieve it via the first line of code?

Here is the jsfiddle with code.

1

1 Answers

0
votes

in your code in JSFiddle, why have you use

var selRow = $("#grid").jqGrid('getGridParam', 'selrow');

look at jqgrid methods

if you need to get the ID of the selected row, use

$('#grid1').jqGrid('getGridParam', 'selrow') ; // only..declare selRow as 1 on top of your code after lastSel..like

var lastSel = -1;

var mydata = [];

var selRow=1;

and to get row data, like you used,

var rowData = $("#grid1").jqGrid('getRowData', rowid); //here rowid: is the id value set on the data source, NOT the index of the row. This returns an object with the column names and value like: {name="teddy", address="here and there", age=34} and get value using

var myName = rowData.name;

object will only have the columns configured on the colModel.Everything that may come on the datasource won't appear here. [more info on this - If you want to have values here that you don't want to show on the grid you must add the column to the colModel collection and set it to hidden: true ]

Hope it helps..