ashl1 / datatables-rowsgroup

The Datatables feature plugin that groups rows (merge cells vertically) in according to specified columns.
Other
95 stars 94 forks source link

rowsGroup event "preDraw" not firing on ajax.reload() #1

Closed alanngnet closed 8 years ago

alanngnet commented 9 years ago

On line 73 of your version 1.0.1 you listen for an event called 'preDraw.dt':

dt.on('preDraw.dt', function ( e, settings) {
    if (self.mergeCellsNeeded) {
        self.mergeCellsNeeded = false;
        self._mergeCells();
    }
})

I'm observing that this event does not fire after reloading the ajax source using table.ajax.reload(); - although the table correctly reloads and displays the newdata, rowsGroup fails to merge the same neighboring duplicate cells that it succeeded in merging on the initial page load.

Possibly relevant: my code has its own listener on the table's "draw.dt" event, although it simply runs a function that does not mess with the table itself. Is there a hook in your plugin that I should be using to trigger rowsGrouping to work in my listener function?

alanngnet commented 9 years ago

I fixed the issue and thus suggest adding the following to your plugin at v. 1.0.1 line 83

dt.on('xhr.dt',function ( e, settings) {
    self.mergeCellsNeeded = true;
})
ashl1 commented 8 years ago

Thanks. I only added required event handlers. The users update the use cases so suggest to handle more events.