Catching sort calls before the actual sort

Catching sort calls before the actual sort

NealiumNealium Posts: 1Questions: 1Answers: 0

I am trying to make a function that removes a row in the table before the table is sorted, i've got a jquery function that listens to the click event for the headers. but when i click the header the table gets sorted and then the jquery function is called, is there any way to reverse the order or a better way of removing a row by id?

Answers

  • allanallan Posts: 63,799Questions: 1Answers: 10,514 Site admin
    edited June 2016

    If you attach a click event listener to the th element before you initialise the DataTable, your event will be executed first (since jQuery just executes them in sequential order).

    edit

    or a better way of removing a row by id?

    Use row().remove() with an id selector for row().

    Allan

This discussion has been closed.