Select All Rows, even those hidden

Select All Rows, even those hidden

vigdalvigdal Posts: 7Questions: 0Answers: 0
edited June 2009 in General
Hi,

I put on each row of my table a check box. I make a button to select/unselect the current page.
Now, i want to make a button to select/unselect the entire table, but it seems the javascript doenst want to change the value of checkboxes that are not visible.

Is there a way to do what i want directly, or must i explore all pages and check all rows in the page i display?

Thanks for your time

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Hi vigdal,

    You can use the API function fnGetNodes() ( http://datatables.net/api#fnGetNodes ) to get an array of all TR elements which you can then do processing on. "$( "input", oTable.fnGetNodes() ).check(true)" for example (not sure if there is a 'check' jQuery function btw!!! Might be best to check that, but this is the general idea.

    Allan
  • vigdalvigdal Posts: 7Questions: 0Answers: 0
    Thank you for your response. That works! :)

    I complete it with this jquery function to check buttons :

    jQuery( "input", oTablefnGetNodes() ).attr('checked', value)
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Perfect - thanks for the update! Good to hear it works :-)

    Allan
This discussion has been closed.