JLynch7 / SlickGrid

A lightning fast JavaScript grid/spreadsheet
https://github.com/jlynch7/SlickGrid/wiki
MIT License
89 stars 76 forks source link

onBeforeHeaderRowCellDestroy event triggered to late #52

Open krzyzak00 opened 11 years ago

krzyzak00 commented 11 years ago

onBeforeHeaderRowCellDestroy event is triggered after $headerRowL.empty() and $headerRowR.empty() calls. jQuery empty() method removes all child nodes, data and event handlers from the child elements so when onBeforeHeaderRowCellDestroy event is triggered there is nothing left to work with. It should be:

$headerRow.find(".slick-headerrow-column")
    .each(function() {
        var columnDef = $(this).data("column");
        if (columnDef) {
            trigger(self.onBeforeHeaderRowCellDestroy, {
                "node": this,
                "column": columnDef
            });
        }
    });

$headerRowL.empty();
$headerRowR.empty();