Setting style per row
Setting style per row
Hi,
I'm using serve-side processing and return a valid JSON with data. Everything works perfectly with paging, sorting, filtering etc. (great tool!). The only thing I miss is how to pass a style information for row. After making a db query on the server side I'd like to mark some rows with different colors (depending on my db query result). So, how can I pass the information to make selected -s marked with class="red" (just an example)?
I'm using serve-side processing and return a valid JSON with data. Everything works perfectly with paging, sorting, filtering etc. (great tool!). The only thing I miss is how to pass a style information for row. After making a db query on the server side I'd like to mark some rows with different colors (depending on my db query result). So, how can I pass the information to make selected -s marked with class="red" (just an example)?
This discussion has been closed.
Replies
You can use fnRowCallback: http://datatables.net/examples/advanced_init/row_callback.html
You could evaluate the contents of your table via JavaScript to set the style, or you could pass an extra column from the server containing style information. Either way, you have to evaluate the information in the row callback to asisgn a style. nRow is the object ( I think ) you need to alter to aplly a row wide css class.
hth, Alex