Hello,
I’m looking for a solution for the following problem:
In dhtmlxgrid I change the backgroundcolor of cells if the content (text or numbers) is changed.
Example:
mygrid.setCellTextStyle(x,y,"background-color:#9FF;");
Additionally to that I write a XML attribute which I can serialize, because I want to save those marked cells and their colors:
//Define XML attribute which needs to be serialized
mygrid.xml.cell_attrs.push("style");
[...]
mygrid.cells(x, y).setAttribute("style","background-color:#9FF;");
This works fine and I can serialize all data.
But when I now do a drag and drop action on an item with cell colors, the XML attribute and the color of the cell is lost after the drag and drop action.
How can I keep the color style and the XML style data?
Thanks for any suggestion.
Just for information, this is my drag&drop attached event, but it should not be the reason why I lose the XML data and the style. This event only marks a certain column yellow when drag&dropped.
//Event triggered when a item is dropped
mygrid.attachEvent("onDrop",
function doOnDrop (sid,tid,sgrid,tgrid){
// sid - id of dragged item , tid - id of landing item
if (sid) {
sid_ar = sid.split(",");
for (var i = 0; i < sid_ar.length; i++){
mygrid.setCellTextStyle(sid_ar[i],1,"background-color:#FF6;");
mygrid.cells(sid_ar[i], 1).setAttribute("style","background-color:#FF6;");
}
}
return true; // mandatory! important!
});