I am having some trouble using the API its not clear to me. I am trying to copy the value of a cell after edit to another cell in the same row. This is what I am doing but how can I write to the cell at (rowID, cell_ID)
function doOnCellEdit(){
var row = mygrid.getSelectedId();
var cell = mygrid.getSelectedCellIndex();
if(cell === 6){
var value = mygrid.cells(row, cell).getValue(); <-- I need after data not before
mygrid.setUserData(row,'username', value); <-- this doesn't work, I need cell only
}
};
function doOnCellEdit(){
var row = mygrid.getSelectedId();
var cell = mygrid.getSelectedCellIndex();
if(stage==2&&cell === 6){
var value = mygrid.cells(row, cell).getValue(); <-- I need after data not before
mygrid.cells(rowID,cell_ID).setValue(value)
}
};
What is the value of stage and where is it defined?
I have a version of this code working the problem becomes the cell that is edited doesn’t take on the edited value but the second cell does. What I need is for both cells to be identical after the edit.
***NOTE ***
After some manipulation I figured it out. Here is the code for anyone who wants to do similar.
I am copying data from cell 6 on edit to cell 8.
function doOnCellEdit(){
var cell = mygrid.getSelectedCellIndex();
if(cell === 6){
var row = mygrid.getSelectedId();
var value = mygrid.cells(row, cell).getValue();
mygrid.cells(row, 8).setValue(value);
}
return true;
};
Try to use the following code.
stage: stage of editing (0-before start[can be canceled if returns false],1- the editor is opened,2- the editor is closed);
mygrid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){
if(stage==2&&cInd=== 6){
var value = mygrid.cells(rId,cInd).getValue(); <-- I need after data not before
mygrid.cells(rId,8).setValue(value)
return true
}
return true
});
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan