DataTable().destroy() failed when the datatable is created with multiple buttons

DataTable().destroy() failed when the datatable is created with multiple buttons

tony-sunhaitaotony-sunhaitao Posts: 1Questions: 0Answers: 0

the error is in line :dataTables.buttons.js:199.

for example if i add three buttons for the datatable, the ilen will be set to value of 3, but once this.remove( buttons[i].node ); is executed, the buttons array size decreases, when i gets to 2 the buttons array has only one element left, so undefined error is reported.
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
this.remove( buttons[i].node );
}

below is my suggstion fo fix:
while(buttons.length > 0){
this.remove(buttons[0].node);
}

Replies

This discussion has been closed.