Dear community!
How would I be able to add conditional row-formatting like:
mygrid.setRowColor(“row1”,“red”);
Only if a certain cell in that row contains a certain value?
Cheers!
Dear community!
How would I be able to add conditional row-formatting like:
mygrid.setRowColor(“row1”,“red”);
Only if a certain cell in that row contains a certain value?
Cheers!
This is one way to do it:
mygrid.load("the url to your grid connector",function(){ // after the dta is loaded completely
mygrid.forEachRow(function(id){ //you may iterate through all the rows
var progress = mygrid.cells(id,1).getValue();
console.log(progress);
if(progress == '100%'){
mygrid.setRowColor(id,"red");
}
});
});
However, can I make this update immediately, not having to refresh the page? Cheers!
You may call the cell value checking from the onCellChanged event:
docs.dhtmlx.com/api__dhtmlxgrid_ … event.html
it will trigger on the data is loading to the grid and after the user make changes to the cell.
mygrid.attachEvent("onCellChanged", function(rId,cInd,nValue){
if(nValue=="100%")
mygrid.setRowColor(rId,"red");
});
Thank you very much!