I'm running the latest version of the jQuery DataTables and using the server side option. I'm running into a problem when trying to complete a simple compare of two columns of data.
This DOCS_VER value in column 5 below will contain a 0 or a 1:
{ "data": "DOCS_VER" },
And the DOCS_WAIT database value in column 6 will contain some kind of text like "Refered" which comes from the database.
{ "data": "DOCS_WAIT" },
My rendering script is shown below and runs only without the else if option. I cannot figure out how to add the additional check for the DOCS_WAIT option.
{
"targets": -4,
"data": "DOCS_VER",
"render": function (data, type, row) {
var color = 'black';
if (data == 1) {
color = 'green';
ColorCheck = 'VALIDATED';
IconChoice = ' fa fa-check-square-o';
} else if (row[6] == 1) {
color = 'orange';
ColorCheck = 'WAITING';
IconChoice = 'fa fa-spin fa-spinner';
} else {
color = 'red';
ColorCheck = 'NON-VALID';
IconChoice = 'fa fa-exclamation-triangle';
}
return '<span style="color: ' + color + '"><i class="' + IconChoice + '"></i> ' + ColorCheck+ '</span>';
},
},
Anyone have any ideas how to properly check row 6 to see if it's a 1 or 0?
row.DOCS_WAITor something like that instead ofrow[6]. You really need to use either a debugger or a console log to make sure thatrowis what you think it is. You can also do a console.log(arguments) if it turns out row isn't actually the right argument for what you want