render table from array, using fnRender, how to set an extra class on row element?
render table from array, using fnRender, how to set an extra class on row element?
hi,
i've been struggling to convert my extensive scripts into a better solution
since i get json from the server, i do not need to first create a dom table and then datatable it.
after rewriting most of my code, with the fnRender option for the custom fields.
i'd like to know how i can handle an extra class on a row.
its easy when you build the table manually, you can add classes or other manipulations anywhere
but the fnRender only lets you return a html string for the field itself
any idea how i can add a class to the row?
do I even need the fnRender for it?
i was trying to build it from within an fn render, and then print the value of the field in the class property of the row (then hide that column)
but 1) i cannot access the row from within the fnRender function
2) that is very dirty, and i was looking to optimize it, not make it even more dirty :P
hope someone has some good input
thanks in advance
Sander
i've been struggling to convert my extensive scripts into a better solution
since i get json from the server, i do not need to first create a dom table and then datatable it.
after rewriting most of my code, with the fnRender option for the custom fields.
i'd like to know how i can handle an extra class on a row.
its easy when you build the table manually, you can add classes or other manipulations anywhere
but the fnRender only lets you return a html string for the field itself
any idea how i can add a class to the row?
do I even need the fnRender for it?
i was trying to build it from within an fn render, and then print the value of the field in the class property of the row (then hide that column)
but 1) i cannot access the row from within the fnRender function
2) that is very dirty, and i was looking to optimize it, not make it even more dirty :P
hope someone has some good input
thanks in advance
Sander
This discussion has been closed.
Replies
Documentation: http://datatables.net/usage/callbacks#fnRowCallback
Example: http://datatables.net/examples/advanced_init/row_callback.html
Allan