I have the following code that works but it has the problem that I have to define 'green' about 20 times, I want to call a function and in that function if it fulfills it that returns the 'green' or in the future another different chain.
BUT NOT having to put 20 times 'green' hair, that is, if it changes, change it on one side only.
columnDefs: [
{
field: 'Type'
},
{
field: 'ID',
cellClassRules: {
'verde': function(params) {
return rowIndexColorDetail(params);
}
}
},
{
field: 'Name',
cellClassRules: {
'verde' : function(params) {
return rowIndexColorDetail(params);
}
}
},
And so 20 times.
function rowIndexColorDetail(params) {
if (params.node.rowIndex === 0 || params.node.rowIndex === 6) {
return true;
} else {
return false;
}
}
I've tried with ...: And that I'm returning the 'green'
cellClassRules: {
function(params) {
return rowIndexColorDetail(params);
}
}
function rowIndexColorDetail(params) {
if (params.node.rowIndex === 0 || params.node.rowIndex === 6) {
return 'verde';
} else {
return false;
}
}
I've also tried But string: I take it as reserved, also to define let color: function(params) { return .......
And also take the color let: as reserved and I can not ...
cellClassRules: {
string: function(params) {
return rowIndexColorDetail(params);
}
}