Hide row on click of a button.
Hide row on click of a button.
Abhi R
Posts: 17Questions: 5Answers: 0
Hello Guys,
I want to hide a row by id on click of a button.
How to do that?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Row hiding in DataTables is done via filtering. You would need to create a custom filter that would remove the rows you don't want to see.
Allan
The problem is I have a delete button. on click of that it's deleting in the backend but in the table, it's not going its still will be there. it only reflects when I refresh the page. So I thought of hiding it. but I'm unable to do that .
So is there anything i can do? on deleting it shouldn't be there in the table.
@Abhi R
Use ajax, with the id, to go back to the server and delete the row. Once done, refresh the table and put the user back on the same page. The row should now be gone.
If you are getting all your data at once, use the ajax to delete the row in question,
Find and delete the row out of the json data then refresh the table with the changed json data.
I can construct an example but it would be tomorrow night at the earliest.
Use
row().remove()
to delete the row from the client-side DataTable if you no longer want it.Allan
bindrid sure. I will be waiting for it.
Thanks allan
This page is a fully function page in my dev environment.
User selects a single row, then clicks the delete button.
An ajax call in made. If the delete was successful, the web method returns the info on the id on the deleted employee.
At that time, the employee is removed from the table, leaving the user on the same page.
Thanks, bindrid it helped a lot