Setting style per row

Setting style per row

comradecomrade Posts: 9Questions: 0Answers: 0
edited December 2009 in General
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)?

Replies

  • pktmpktm Posts: 27Questions: 0Answers: 0
    Hi!

    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
This discussion has been closed.