Trigger fnRender options based on other columns

Trigger fnRender options based on other columns

dgreendgreen Posts: 6Questions: 0Answers: 0
edited July 2012 in General
So, I currently mucking with fnRender in order to add additional functionality with images for my datatable. The data living on my SQL server has a field which currently encodes a few selector options as a binary string. There are a few key options that the user will want to quickly see, so I want to render an icon if that bit is flagged, but I also want to be able to CHANGE that icon as they edit the data if they disable the option. Presently, my desired implementation is:

[code]
//Desired layout
|(Hidden)|Option_1|Option_2|Option_3|Option_4|
| 1001 | Yes | No | No | Yes |
| 0100 | No | Yes | No | No |
| 0011 | No | No | Yes | Yes |

/* from aoColumnDefs options */
{
"aTargets": [0],
"sTitle": "(Hidden)",
"mDataProp": "Options_List"
},
{
"aTargets": [1],
"sTitle": "Option_1",
"mDataProp": null, //Using ("mDataProp": "Options_List") causes the object to encounter errors
"fnRender": function(obj) {
var Option_Status = obj.aData[0];
if (Option_Status & 1000) {
Option_Status = "Yes"; //These are objects in my actual code, but the idea is the same
} else {
Option_Status = "No";
}
return Option_Status;
}
},
/* Option_2 through Option_4 is similar */
[/code]

This works fine for the initial render, but if I were at some point to execute

[code]oTable.fnUpdate('0110',TargetRow,0);[/code]

it would update the (Hidden) column value, but the visible Option columns would not update their render based on the new data. Is there a way to get the other columns to update their fnRender output by editing only the contents of the cell in (Hidden), or is there another work around I should be using?

Thanks.
This discussion has been closed.