highlight low date

highlight low date

infotbainfotba Posts: 17Questions: 3Answers: 0

external json file is like..

{
"data": [
{
"planned_date":"11/10/2017",
"actual_date":"07/03/2018"
},
....
]
}
.....

code is :
{
"targets": [2],
"createdCell": function (td, cellData, rowData, row, col) {
if ( cellData > data.planned_date ) {$(td).addClass('highlight')}
}
},

does not run. But
...
{
"targets": [2],
"createdCell": function (td, cellData, rowData, row, col) {
if ( cellData > "11/10/2017") {$(td).addClass('highlight')}
}
},
runs

Please help me. Thanks

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    Answer ✓

    Instead of:

    "createdCell": function (td, cellData, rowData, row, col) {
    if ( cellData > data.planned_date ) {$(td).addClass('highlight')}
    }
    

    Try:

    "createdCell": function (td, cellData, rowData, row, col) {
    if ( cellData > rowData.planned_date ) {$(td).addClass('highlight')}
    }
    

    The parameter for the full row data is rowData not data. Please see columns.createdCell for details.

    Kevin

  • infotbainfotba Posts: 17Questions: 3Answers: 0

    kthorngren, thank you

This discussion has been closed.