Hi, I’m using the last version of dhtmlxTreeGrid and I have a problem, the setCellTextStyle not run.
Following the samples i put:
if (cap > 0)
{
pct = (sum * 100) / cap;
myCal.cells2(rowInd,col).setLabel(pct.toFixed(1) + ’ %’);
if (pct > 100)
{
myCal.setCellTextStyle(rowInd,col,‘background-color:MistyRose; color:DarkGrey;’);
//alert(pct + ’ :: ’ + rowInd + ’ :: ’ + col);
}
The label is already changed, but the Style not.
Before this code I run
myCal.setRowColor(rowId,’#FFFFE0’);
and I try to set the color with style in the XML code, but I have the same results, don’t change the style '-(
Any sugestion?
Thanks
The row color set by different command has different priority, from top to low it will be
- color set through row@style, cell@style, setRowTextStyle. setCellTextStyle
- colors of selected rows
- color set by cell@class
- color set by row@class
- color set by row@bgcolor, setRowColor
- default color defined in CSS
So if you have setting of color in style from XML it will override setRowColor command settings.
You may try to use
grid.setRowTextStyle(rowId,“background-color:#FFFFE0”);
it must override style defined from XML.
I supose that I have some problem with te setCellTExtStyle.
If I comment all previous style references and leave only this code
if (pct > 100)
{
alert(pct + ’ :: ’ + rowInd + ’ :: ’ + col);
//myCal.setCellTextStyle(rowInd,col,‘background-color:MistyRose; color:DarkGrey;’);
myCal.setCellTextStyle(rowInd,col,‘background-color:#FF0000’);
}
I view the alert correctly but the color not change.
Not sure, but maybe you are using incorrect parameter
* @param: row_id - row id
setCellTextStyle(row_id, ind, styleString)
The first parameter is a row ID, while in your code it is a rowInd ( row index ? )
To convert row index to rowID grid.getRowId(rowInd) can be used
thanks I’m thrusted on the parm was the row Index like in .cells2(ind,col).setLabel()
sorry.
It run correctly.