hide specific rows?
hide specific rows?
spyderfusion02
Posts: 4Questions: 0Answers: 0
Hey,
I have a web page with a table that displays data from a database. There is a main being displayed and an additional that is hidden and only displays with jquery when the user clicks a button that is on the first main .
The problem that I am getting is when I use the datatables plugin, it finds all the rows and counts them, so I have 11 rows of data and 11 additional hidden rows under each main row. It then displays at the button of the table "Showing 1 to 10 of 22 entries". I don't want Datatables to count or see the hidden rows. I there a way to fix this problem. All 's have ID's and classes, so I thought there might be a simple way of sorting this data properly.
Also, when I do click the main to display the hidden it does not slide down under the main I clicked, instead It goes above all the main 's. Anyone know why?
Thank you for any help.
I have a web page with a table that displays data from a database. There is a main being displayed and an additional that is hidden and only displays with jquery when the user clicks a button that is on the first main .
The problem that I am getting is when I use the datatables plugin, it finds all the rows and counts them, so I have 11 rows of data and 11 additional hidden rows under each main row. It then displays at the button of the table "Showing 1 to 10 of 22 entries". I don't want Datatables to count or see the hidden rows. I there a way to fix this problem. All 's have ID's and classes, so I thought there might be a simple way of sorting this data properly.
Also, when I do click the main to display the hidden it does not slide down under the main I clicked, instead It goes above all the main 's. Anyone know why?
Thank you for any help.
This discussion has been closed.
Replies
Hiding rows in DataTables is done through the filtering options that are provided. It might be possible to set up what you are looking for using a few tricks with fnFilter() and a hidden column. There is however another options, DataTables provides two functions for appending a child row to a given row through the fnOpen() and fnClose() - you can see these in action in this example: http://datatables.net/1.5-beta/examples/api/row_details.html
Hope this helps!
Regards,
Allan
Thanks.
Yes indeed you could do as you suggest. All you need to do is to make use of fnOpen() inside the Ajax callback function (witht he Ajax call being made to your PHP file on the server) and pass it whatever it is that you want from the server.
Regards,
Allan
Thank you.
It's actually very difficult (if not impossible) to animate table row heights fully (see for example http://www.nabble.com/Animating-table-rows-td20491521s27240.html , plenty of others on Google as well).
So it's possible to animate from say 1px up (just insert it with 1px height) and the after the fnOpen() call animate the height and line height.
Regards,
Allan