Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by oconstance on Jan 20, 2009 22:10
open dhtmlx forum
compare two grids

hi all,
i have two questions:
1) i am trying to compare two grids and change font bold for cells which are different.
how can i do that in javascript?


2)when somes changes have been done by the user into a grid (for axample the user change the values of 4 cells)
how can i transmit the xml of the grid as it was before changes and after changes.

thanks very much
Answer posted by Support on Jan 21, 2009 03:48
>>how can i do that in javascript?
You can use something similar to the next ( assuming that both grids have rows with equal IDs )

var columns = mygrid.getColumnsNum();
mygrid.forEachRow(function(id){
      for(var i=0; i<columns; i++)
            if (mygrid.cells(id,i).getValue()!=mygrid2.cells(id,i).getValue())
                 mygrid.setCellTextStyle(id,i,"background-color:red;")
});


>>how can i transmit the xml of the grid as it was before changes
There is no way to get xml of grid as it was before changes, but current state can be received as 
var xml = grid.serialize();