Removing rows based on a filter
Removing rows based on a filter
bickle
Posts: 8Questions: 0Answers: 0
I'm having some difficulty with deleting rows based upon filter results. I've tried both looping through the filter results and using the new rows().remove(), with varying levels of success.
I have a demo here at http://live.datatables.net/lijoyay/13/ . There are two buttons at the top that run a function that attempts to remove all rows where Office='New York'. If I use the looping button, the wrong records are deleted (I'm using draw(false). If I try the rows().remove() method, it just fails outright. So I assume that I'm referring to the filtered data incorrectly, but when I view the array in Firebug, I just see the rowindex, which is what I thought I needed.
Thanks,
I have a demo here at http://live.datatables.net/lijoyay/13/ . There are two buttons at the top that run a function that attempts to remove all rows where Office='New York'. If I use the looping button, the wrong records are deleted (I'm using draw(false). If I try the rows().remove() method, it just fails outright. So I assume that I'm referring to the filtered data incorrectly, but when I view the array in Firebug, I just see the rowindex, which is what I thought I needed.
Thanks,
This discussion has been closed.
Replies
A workaround would be to use the `toArray()` method chained onto your `filter()` . However:
I've committed a fix here: https://github.com/DataTables/DataTablesSrc/commit/d9f41623 and I'll sync up the nightly build once I've finished going through the forum posts this morning incase there is anything else duff that needs to be fixed!
Thanks for flagging this up and the test case - hugely appreciated!
Regards,
Allan