How to hide rows instead of deleting them in DataTable pagination switch
How to hide rows instead of deleting them in DataTable pagination switch
mirzaei.sajad@hotmail.com
Posts: 9Questions: 2Answers: 0
After switch between pages in pagination view, DataTable remove another "tr" and keep only called page rows (tr),
how to hide them instead of deleting, look at this picture please:
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I think what you are looking for is in this thread. See Colin's example:
https://datatables.net/forums/discussion/comment/137757/#Comment_137757
Kevin
@colin
Thanks for reply, I did what you said in this url:
http://live.datatables.net/tubisanu/1/
You will change the data values on both pages then click on "Click here for GetSum" , you will see that it will give you the sum of the values on the same page, not all pages.
@kthorngren
thanks Kevin,
My problem is different, please look at this url:
http://live.datatables.net/tubisanu/1/
or this url:
http://live.datatables.net/tubisanu/2
Thank you for the fiddle, but I'm sorry, I'm really not following. Could you give step by steps with that last fiddle on how to reproduce your issue, and what you would expect to happen instead, please.
Colin
@colin
First, thank you very much for your response,
look at this url please:
http://live.datatables.net/tubisanu/2
I entered values 1, 4, 5 on the first page (Data column),
then, I entered values 4, 3 on the second page,
Then I click on the "Click here for GetSum",
I expect to see in front of the "Sum" sum of all values,
I expect to see sum of all values ( Sum: 17 ),
But the number I see is 7,
Because in DataTable you can only see the sum of the values entered on the last page, But I want to have sum of values entered on all pages.
Gotcha, you can do something like this: http://live.datatables.net/fuxosopu/1/edit
Colin
@colin
Thanks..
Great for the new tables I want to build,
But I have a project with about 800 pre-built tables in specified files..
I want to add to DataTables framwork now, and I'm having trouble
I have to change about 800 tables, it takes a long time
Is it possible or option for DataTable to hide records in the body of table instead of deleting them? (look at the first comment please)
You can't hide, only
row().remove()
to remove them. Even if you could remove, wouldn't changing that code also the same effort to change for those 800 tables?Colin
@colin
The project was made with C# and the tables were designed with "ASP:GridView"
And the sum of values is taken to the server with C#
So it's not possible to access client side rows and columns unless it puts all these values in a field and passes them to the server side(c#).
This problem would have been solved if DataTable was hiding them(rows) after each filter rather than deleting rows
Datatables manipulates the DOM to display only the rows for the page being displayed. All the data is contained in the Datatables data cache and you can access it using Datatatables APIs like
rows().data()
. You will need to change the code you are using to obtain the data now to usie one of the Datatables APIs.Kevin
@kthorngren
Thanks my friend, I know
My problem is when you want to modify that user-side information(In the Table drawn) and send it to the server.
Anyway,
Thanks to all,
DataTable is really the best.