Reputation: 969
I have a jqGrid in grouping mode that works fine on initial load. However, when I clear that same grid, and copy data into that same grid, some of the rows in the grid are lost after the copy.
Here is the grid after initial load, before I clear it and copy in data:
Now, here is the same grid, after I clear it and copy in the same data:
Notice that I am missing the last row of data. In order to copy the data, I'm using setGridParam
and then triggering a reloadGrid
, like this:
function copyToGrid(jsonData) {
var grid = $('myGrid');
grid.jqGrid('clearGridData');
grid.jqGrid('setGridParam', { datatype: 'local', data: jsonData });
grid.trigger('reloadGrid');
}
I have verified that my jsonData
does contain all the data that I want to copy into the grid. Also, I do not use addRowData
because that does not work with grouping in jqGrid.
I have tried explicitly setting grouping parameters in the setGridParam
call, like this:
grid.jqGrid('setGridParam', { datatype: 'local', data: jsonData, grouping: true });
grid.jqGrid('groupingGroupBy', columnName);
But, this does not work, either.
QUESTIONS:
Am I missing some more parameters in the setGridParam call?
Do I need to set other parameters on the grid?
Thanks very much for your help!
Upvotes: 1
Views: 558
Reputation: 969
Thanks to Oleg, once again, for his prompting to post more code, especially the grid options. I reviewed my grid definition, and found that I was using rowNum: -1
. This rowNum option is apparently still broken. So, I changed it to rowNum: 10000
, and now my copy function works fine. It seems strange that rowNum: -1
worked for my initial grid load, but not for copying data into the grid.
Anyway, I have upvoted Oleg's comment, and will upvote the SO post that I have linked in this answer.
Upvotes: 1