Select All Row

Select All Row

argentario84argentario84 Posts: 3Questions: 0Answers: 0
edited February 2012 in General
Hi all,
i have a table with 1000 row.
I put a button named "Select All" near my table, and i want, if button is clicked, change css class to all table rows.

I made this with this instruction, where "table3" is name of my datatables object.

[code]$('td', table3.fnGetNodes()).addClass('row_selected');[/code]

When i click the button, the script does what I expect, after several alert "A script on this page is causing internet explorer to run slowly".

Is there a better way to make what i want?

Thanks and sorry for my poor English!

Replies

  • AAAlexanderAAAlexander Posts: 1Questions: 0Answers: 0
    HI, try simply

    [code]$('#exampleTable tr').addClass('row_selected');[/code]
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    You could try:

    [code]
    table3.$('td').addClass('row_selected');
    [/code]

    however, do you really want to add the class to the TD cells rather than the TR rows (as AAAlexander suggests)? Adding to the cells is always going to be slow in IE, no matter how you do it.

    Allan
This discussion has been closed.