change row selected class after table has already been rendered
change row selected class after table has already been rendered
doug_hale_jr
Posts: 22Questions: 0Answers: 0
Hey everyone,
I have a datatables that is rendered on a page. The user can then select an option from a drop down that pulls some data via ajax so the page is not refreshed. The data contains row numbers. I want to change the class of the rows in the data table to be row selected for every row that was returned in the data from the ajax call. The data is returned in an array.
Can you point me to an example or provide some guidance to do this?
Thanks
Doug
I have a datatables that is rendered on a page. The user can then select an option from a drop down that pulls some data via ajax so the page is not refreshed. The data contains row numbers. I want to change the class of the rows in the data table to be row selected for every row that was returned in the data from the ajax call. The data is returned in an array.
Can you point me to an example or provide some guidance to do this?
Thanks
Doug
This discussion has been closed.
Replies
To do this you would do it more or less as you would without DataTables, but instead of using $('tr') as a selector for the rows, you can use oTable.fnGetNodes() - which will return an array of the TR elements. Then you can loop over them applying and removing classes as needed.
Hope this helps,
Allan