I can assign a class to a cell using:
myGrid.cells(rId,cId).cell.className=“bdblue”;
But if I do that it overrides any existing class for that cell. If I can get any existing class for that cell first, then I could assign both the new class and the existing class to the cell.
My question: Is there a grid function in your API for getting a cell’s class?
You may use the getAttribute() method:
https://docs.dhtmlx.com/grid__cell_level_api.html#getattribute
For example:
myGrid.cellById(rId,cInd).getAttribute('class');
If I run the following:
myGrid.cells(108,57).cell.className=“xyz”;
alert(myGrid.cellById(108,57).getAttribute(“class”));
I can then see in the Web Console that indeed the cell now has the class of “xyz”.
However, the result I get in the alert is: undefined
I see.
You’re right. Unfortunately it is not available to manipulate with the cell classes using the setAttribute/getAttribute methods.
Unfortunately there is no official API allowing to add classes to the grid cells.
You may use your original format:
myGrid.cells(rId,cId).cell.className
it allows to get the cells class and to set(append) it.