Author Topic: Adding row in pqgridcellsave throws Uncaught TypeError  (Read 3660 times)

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Adding row in pqgridcellsave throws Uncaught TypeError
« on: April 23, 2014, 11:05:39 pm »
Hi guys,
I am adding a row in the cell save event and it gives me a following exception:
Uncaught TypeError: Cannot read property 'offsetParent' of undefined
The exception happens only when I click with mouse on another cell withing the grid. Tab is working fine.
The code is very simple:
    $grid.on("pqgridcellsave", function (evt, ui) {
        var newVal = ui.newVal, dataIndx = ui.dataIndx, rowIndx=ui.rowIndx;
       
        if (newVal) {
            var data = $grid.pqGrid("option","dataModel.data");
            if (data) {
                var rowsCount=data.length-1;
                if (rowsCount == rowIndx) {
                    $grid.pqGrid("addRow", {rowData:{}});
                }
            }
        }
    });

Here is the call stack:
Uncaught TypeError: Cannot read property 'offsetParent' of undefined pqgrid.min.js:9
g._generateCellRowOutline pqgrid.min.js:9
(anonymous function) jquery-ui-1.10.4.custom.js:401
g._editCell pqgrid.min.js:9
(anonymous function) jquery-ui-1.10.4.custom.js:401
g.editCell pqgrid.min.js:9
(anonymous function) jquery-ui-1.10.4.custom.js:401
(anonymous function)
« Last Edit: April 23, 2014, 11:07:34 pm by stoodin »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Adding row in pqgridcellsave throws Uncaught TypeError
« Reply #1 on: April 25, 2014, 12:19:35 am »
Thanks for pointing out this error.

I checked it and didn't face this error unless there is a datepicker editor in of the cells.

Do you also face this issue when there is a datepicker editor.

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Re: Adding row in pqgridcellsave throws Uncaught TypeError
« Reply #2 on: April 25, 2014, 01:59:35 am »
I actually have a dropdown editor.
The complete test code to reproduce it attached.
Would be great if you can fix it :-)

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Adding row in pqgridcellsave throws Uncaught TypeError
« Reply #3 on: May 28, 2014, 09:47:18 am »
Please check it with latest version 2.1.0. I presume it's fixed.