hide specific rows?

hide specific rows?

spyderfusion02spyderfusion02 Posts: 4Questions: 0Answers: 0
edited July 2009 in General
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.

Replies

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi spyderfusion02,

    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
  • spyderfusion02spyderfusion02 Posts: 4Questions: 0Answers: 0
    For my hidden rows I am grabbing information from the database and displaying it dynamically. If I were to use the fnOpen and fnClose it is possible to include my php file that grabs the info from a mysql db and display it in the new row?

    Thanks.
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi spyderfusion02,

    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
  • spyderfusion02spyderfusion02 Posts: 4Questions: 0Answers: 0
    also, I forgot to ask if it is possible to use animations with the open and close functions. I would like them to slide down instead of poping up. is this possible?

    Thank you.
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi spyderfusion02,

    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
This discussion has been closed.