ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: forwheeler on December 04, 2013, 07:08:14 pm
-
I can double click on any cell, make an edit and save it by hitting the enter key on page one. On any other page when I hit enter after making the edit, it acts like a return key and creates a new line instead of saving the cell. What setting controls this?
var obj = {
width: 700, height: 0,
dataModel: dataModel,
colModel: colModel,
columnBorders: true,
flexHeight: true,
flexWidth: true,
paging: true,
scrollModel: { horizontal: false },
freezeCols: 0,
editModel: { clicksToEdit: 2, saveKey: 13 },
cellSave: function (event, ui) {
jsonstring = { "ID": ui.data[row].ID, "FiscalYear": ui.data[row].FiscalYear };
Update(JSON.stringify(jsonstring));
},
-
paging should be 'local', 'remote' or null. Rest looks fine.
Example:
http://jsfiddle.net/LAgZx/185/
-
I found that the offending code when I use the cellSave property on any page other than one. I get the error: Unable to get property 'ID' of undefined or null reference. I get this for each property of data. When I debug, ui and data are not null and neither is row. Is this a proper way to get the data and build a json object?
cellSave: function (event, ui) {
jsonstring = { "ID": ui.data[row].ID, "FiscalYear": ui.data[row].FiscalYear };
Update(JSON.stringify(jsonstring));
},
-
SOLVED
In my original code sample I didn't include where I got the row index. I was getting it from ui.rowIndx which is the index from the whole grid and not the current page. I changed it to ui.rowIndxPage which is the index of the current page. It now works.
cellSave: function (event, ui) {
//var row = ui.rowIndx;
var row = ui.rowIndxPage;
jsonstring = { "ID": ui.data[row].ID, "FiscalYear": ui.data[row].FiscalYear };
Update(JSON.stringify(jsonstring));
},