Using jQuery Objects with rows().remove() removes all rows.
Using jQuery Objects with rows().remove() removes all rows.
Hello again!
Another day another issue
I'm trying to delete certain rows from my table using selected jQuery objects.
Here is a link to my example: http://live.datatables.net/jeneyera/1/
As you can see I am calling rowsToDelete = $(".eventRow:eq(0)");
which should be removing only the first row in the table, but it actually removes everything.
If you look in the console I'm outputting the jQuery object and it is definitely only returning a single row, meaning something is going wrong with the remove() itself.
Any ideas?
Thanks,
Dan
This question has an accepted answers - jump to answer
Answers
Hi Dan,
The
remove()
method doesn't accept any parameters as therows().remove()
documentation shows.Use the
rows()
method to select the rows you want to perform an action on and then call that action method.http://live.datatables.net/jeneyera/2/edit
Allan
Hi Allan,
Looks like I just put the parameter in the wrong method.
Silly me, thanks for letting me know.