Hello DT community. I have been pulling my hair out trying to come up with a solution to applying a class name to certain TD elements in the html table (server side if possible, although not necessary).
I'm looking for a solution similar to the DT_RowClass; however, I need something to the effect of DT_CellClass.
More specifically, I have my own server side processing script (PHP) that is pulling data from 2 different tables, comparing the data and outputting a single array to JSON. (I do not have the cell class piece working yet, so I can do the JSON output no problem; in other words, my "comparing" feature of the php script is NOT actually affecting the data at this point).
SO, I'm up for whatever will work.
In short, I'm just trying to assign a class name to certain TD elements.
My thought is that it would look like this:
So on the PHP side I would do something like:
My thoughts were heading towards adding a new array to the cell for the JSON output to look something like:
At any rate, as you may can tell I do not have it figured out yet. I've looked at the fnRowCallback() method, however the problem I have on the javascript side is that I have no way of "comparing" the data from my two tables.
Any suggestions are welcome.
Thanks!
I'm looking for a solution similar to the DT_RowClass; however, I need something to the effect of DT_CellClass.
More specifically, I have my own server side processing script (PHP) that is pulling data from 2 different tables, comparing the data and outputting a single array to JSON. (I do not have the cell class piece working yet, so I can do the JSON output no problem; in other words, my "comparing" feature of the php script is NOT actually affecting the data at this point).
SO, I'm up for whatever will work.
In short, I'm just trying to assign a class name to certain TD elements.
My thought is that it would look like this:
<tr id="1"> <td class="white">some data</td> <td class="yellow">some data</td <tr>
So on the PHP side I would do something like:
if(array1[$cell]==array2[$cell]){$class = "white"} else {$class = "yellow"} /*Some other sweet code that will get class=$class into the correct TD element/cell!!*/
My thoughts were heading towards adding a new array to the cell for the JSON output to look something like:
{"aaData": [ { "DT_RowId":"1" [ "DT_CellClass": "yellow" ] } ] }But even then, I'm not sure A) how I would make that work and B) how to process it on the javascript side.
At any rate, as you may can tell I do not have it figured out yet. I've looked at the fnRowCallback() method, however the problem I have on the javascript side is that I have no way of "comparing" the data from my two tables.
Any suggestions are welcome.
Thanks!