mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.82k stars 1.98k forks source link

Colspan Issue #1064

Open daeks opened 9 years ago

daeks commented 9 years ago

Dear Team,

I have discovered an issue while using the colspan function described in the examples. I have defined some columns and init the dataview with the following code:

dataView = new Slick.Data.DataView();
dataView.getItemMetadata = function (row) {
    var item = dataView.getItem(row);
    // item could be null if no rows and grid option add row is enabled
    if(item && item.__parent) {
        var parent = grid.getCellNode(dataView.getRowById(item.__parent), 0).parentNode;
        // do some other stuff  
        return {"columns" :  {"__file" :  {"colspan" : grid.getColumns().length - 1}}};
    }
};

So if I now add new lines like following workflow, I am getting an issue with hidden rows:

Step 1: Drop some new rows

step1

Step 2: Drop one new row on another to get __parent attribute filled and colspan applied

step2

Step 3: Now if I drop another row above the previous targeted some rows are getting hidden. If I do that below the previous targeted row, everything is working fine

step3

I am getting this exception in console:

"TypeError: Unable to get property 'lastChild' of undefined or null reference at ensureCellNodesInRowsCache (/js/libraries/slick.grid.js:1741:11) at getCellNode (/js/libraries/slick.grid.js:3077:9)