EvHaus / doby-grid

An HTML table element on steroids.
Other
14 stars 5 forks source link

postprocess not getting called on all rows (0.1.1) #178

Open thomb opened 9 years ago

thomb commented 9 years ago

After upgrading to 0.1.1 I've having an issue with post process on column formatters functions not being executed on each row, its skipping the rows seemingly at random.

Its worth noting that I am modifying the height of the grid rows in the postprocess function.

Here's the code for my formatter:

           this.postprocess = function (data, callback) {
            if (data.data.__nonDataRow) return;

            var summaryContainer = data.$cell.find('.summary_container');

            if (summaryContainer.length === 0)  return;
            this.gridInstance = data.grid;
            var summaryHeight = 0;
            if (summaryContainer.find('.expandRow').length !== 0) {
                summaryHeight = summaryContainer.find('.expandRow').data().summaryHeight;
            }

            // if the user has not enabled row resizing get out of here
            if (!options.grid.options.autoResizeRows) {
                callback();
                return;
            } else if (summaryHeight !== 0 && summaryHeight > data.$cell.height()) {
                data.data.height = summaryHeight;
                data.grid.setItem(data.data.get('id'), data.data);
                callback();
                return;
            }

            callback();

        }.bind(this);

There may be an issue with the formatter, but if I look at the data being passed into the function it will randomly skip a row, causing one row to bleed into the next.