Dynamic tables - access to row classes or styles

Dynamic tables - access to row classes or styles

CrashMeisterCrashMeister Posts: 8Questions: 0Answers: 0
edited September 2011 in General
I have a dynamic table that changes based on user activity. I use fnClearTable(), then fnAddData() and finally fnDraw(true) to redraw the table.

The table has rows that are only added if the user has checked a checkbox on the parent row. These child rows need to have different backgrounds to the parent (always visible) rows.

How can I change the background while generating the table ?

Thanks,
Craig.

Replies

  • CrashMeisterCrashMeister Posts: 8Questions: 0Answers: 0
    edited September 2011
    BTW, I see in the CSS that there are gradeA, gradeB etc rows. Can these be used and if so, how are they set up ?

    Thanks,
    Craig.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Those were set up for specific examples on the DataTables website. You can use them or similar classes to provide formatting for your cells or other elements in your table.

    You can provide a class name for any column ("sClass" property) or apply a class to cells, rows or other DOM elements on-the-fly based on their content using various callbacks (fnRowCallback, fnDrawCallback, to some degree also with fnRender (for content WITHIN a cell, but not the cell itself))

    to change row css based on checkmark, iterate through your TABLE rows (or use fnRowCallback), look for that TD, get the value of the checkbox, then apply a CSS class to the TR.
  • CrashMeisterCrashMeister Posts: 8Questions: 0Answers: 0
    Thanks, I used fnRowCallback to solve the issue.
This discussion has been closed.