Author Topic: Can't edit on any page besides one  (Read 4114 times)

forwheeler

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Can't edit on any page besides one
« 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?

 
Code: [Select]
        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));
            },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Can't edit on any page besides one
« Reply #1 on: December 04, 2013, 07:28:32 pm »
paging should be 'local', 'remote' or null. Rest looks fine.

Example:

http://jsfiddle.net/LAgZx/185/
« Last Edit: December 04, 2013, 07:34:18 pm by paramquery »

forwheeler

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Can't edit on any page besides one
« Reply #2 on: December 04, 2013, 10:59:36 pm »
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?

Code: [Select]
cellSave: function (event, ui) {
                jsonstring = { "ID": ui.data[row].ID, "FiscalYear": ui.data[row].FiscalYear };

                Update(JSON.stringify(jsonstring));
            },

forwheeler

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Can't edit on any page besides one
« Reply #3 on: December 05, 2013, 01:39:29 am »
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.

Code: [Select]
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));
            },