Question

I have data column with value '1' or '0' and I need to show 'enabled' or 'disabled' in the grid.

How can I show different values in the grid based on input value?

Was it helpful?

Solution

Answer:

function formatterActive(row, cell, value, columnDef, dataContext) {
    if( value == '1' ) {
        return 'enabled';
    } else { // '0'
        return 'disabled';
    }
}

columns : [
    // ...
    { id: 'active', name: 'active', field: 'active', formatter: formatterActive }
],
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top