We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

After edit cell, change its background in Gridweb Java

Hello,

Is there any event that after editing a cell, i can change its style in order to differentiate the cells hthat have been updated from Java?

Thank you!

@nenciuioa,

I think you can try to handle it on client-side (JavaScript) functions. You may try to set OnCellUpdatedClientFunction event attribute to specify it to some client side function defined where you write your code to change the background color of the cell.

1 Like

@nenciuioa
here is a document for this:

the key point is:
in server side set those attribute:

  gridweb.setEnableAJAX(true);
  gridweb.setOnAjaxCallFinishedClientFunction("TestAjaxCallFinish");
  gridweb.setOnCellUpdatedClientFunction("CellUpdate");

and then in the client side page add the js:

let updateCells = new Array();

function TestAjaxCallFinish(){
for (var i = 0; i < updateCells.length; i++) {

     console.log("updated:" + toString(this,updateCells[i]));
     //###### here we can set background color for the cell children span node #####//
     updateCells[i].children[0].style.backgroundColor='red';

 }
 updateCells = [];

}

function CellUpdate(cell) {
//here the cell is just the html node of the updated cell
var id = updateCells.length;
updateCells[id++] = cell;
}

function toString(gridweb,cell) {

 return gridweb.getCellName(cell) +

     ",value is:" +

     gridweb.getCellValueByCell(cell) +

     " ,row:" +

     gridweb.getCellRow(cell) +

     ",col:" +

     gridweb.getCellColumn(cell);

}

1 Like