Custom onEditCell Event function does not store new value

Hi,



I try to store the new value in my cell. This is my simple funtion



function doOnCellEdit(stage,rowId,cellInd,newVal,oldVal){

if(stage==0){

return true;

}

if (stage == 1) {



return true;

}

if (stage == 2) {

this.cells(rowId, cellInd).setValue(newVal);

alert(this.cells(rowId, cellInd).getValue());

alert(oldVal);

}



}



I m using mutiple grids with this for loop : <br> <br>for (var i = 0; i < g_xmlDataTablesString.length; i++) { <br> <br> rawGridArray[i] = new dhtmlXGridObject("" + g_xmlDataTablesString[i] + ""); <br> rawGridArray[i].setEditable(true); <br> rawGridArray[i].attachEvent("onEditCell", doOnCellEdit); <br> rawGridArray[i].setImagePath("codebase/imgs/"); <br> rawGridArray[i].init(); <br> <br> rawGridArray[i].loadXML("" + "../" + g_xmlDataTablesString[i] + ".xml" + ""); <br> rawGridArray[i].setSkin("light"); <br> rawGridArray[i].enableLightMouseNavigation(true); <br> <br> <br> } <br>My xml file for initialization (filled with sample data) <br> <br><?xml version="1.0" encoding="UTF-8"?> <br><rows total_count="10"> <br> <head> <br> <column type="ro" sort="str" width="70">Rechner</column> <br> <column type="ed" sort="int" width="70">64</column> <br> <column type="ed" sort="int" width="70">128</column> <br> <column type="ed" sort="int" width="70">256</column> <br> <column type="ed" sort="int" width="70">512</column> <br> <column type="ed" sort="int" width="70">1024</column> <br> <column type="ed" sort="int" width="70">2048</column> <br> <column type="ed" sort="int" width="70">4096</column> <br> <column type="ed" sort="int" width="70">8192</column> <br> <beforeInit> <br> <call command="enableResizing"> <br> <param>false,true,true,true,true,true,true,true,true</param> <br> </call> <br> </beforeInit> <br> </head> <br> <row id="1"> <br> <cell>pc01</cell> <br> <cell>8762</cell> <br> <cell>9223</cell> <br> <cell>9148</cell> <br> <cell>10136</cell> <br> <cell>10317</cell> <br> <cell>10498</cell> <br> <cell>10975</cell> <br> <cell>11068</cell> <br> </row> <br> <row id="2"> <br> <cell>pc02</cell> <br> <cell>8044</cell> <br> <cell>9065</cell> <br> <cell>8387</cell> <br> <cell>10129</cell> <br> <cell>10559</cell> <br> <cell>10735</cell> <br> <cell>10974</cell> <br> <cell>11046</cell> <br> </row> <br> <row id="3"> <br> <cell>pc03</cell> <br> <cell>7421</cell> <br> <cell>9393</cell> <br> <cell>8289</cell> <br> <cell>10084</cell> <br> <cell>10192</cell> <br> <cell>10807</cell> <br> <cell>10929</cell> <br> <cell>11088</cell> <br> </row> <br> <row id="4"> <br> <cell>pc04</cell> <br> <cell>7380</cell> <br> <cell>7363</cell> <br> <cell>9717</cell> <br> <cell>8420</cell> <br> <cell>10061</cell> <br> <cell>9983</cell> <br> <cell>10816</cell> <br> <cell>10673</cell> <br> </row> <br> <row id="5"> <br> <cell>pc05</cell> <br> <cell>7347</cell> <br> <cell>8212</cell> <br> <cell>5262</cell> <br> <cell>7921</cell> <br> <cell>10335</cell> <br> <cell>10063</cell> <br> <cell>10870</cell> <br> <cell>10941</cell> <br> </row> <br> <row id="6"> <br> <cell>pc06</cell> <br> <cell>6196</cell> <br> <cell>9169</cell> <br> <cell>5143</cell> <br> <cell>7747</cell> <br> <cell>9500</cell> <br> <cell>8959</cell> <br> <cell>10815</cell> <br> <cell>11112</cell> <br> </row> <br> <row id="7"> <br> <cell>pc07</cell> <br> <cell>8057</cell> <br> <cell>5745</cell> <br> <cell>8065</cell> <br> <cell>9127</cell> <br> <cell>9605</cell> <br> <cell>9978</cell> <br> <cell>10245</cell> <br> <cell>10504</cell> <br> </row> <br> <row id="8"> <br> <cell>pc08</cell> <br> <cell>6322</cell> <br> <cell>5143</cell> <br> <cell>8914</cell> <br> <cell>7045</cell> <br> <cell>8026</cell> <br> <cell>10712</cell> <br> <cell>9409</cell> <br> <cell>10515</cell> <br> </row> <br> <row id="9"> <br> <cell>pc09</cell> <br> <cell>8179</cell> <br> <cell>8440</cell> <br> <cell>9696</cell> <br> <cell>10254</cell> <br> <cell>10533</cell> <br> <cell>10716</cell> <br> <cell>10870</cell> <br> <cell>11025</cell> <br> </row> <br> <row id="10"> <br> <cell>pc10</cell> <br> <cell>7658</cell> <br> <cell>9310</cell> <br> <cell>9773</cell> <br> <cell>8604</cell> <br> <cell>10370</cell> <br> <cell>10814</cell> <br> <cell>10977</cell> <br> <cell>10797</cell> <br> </row> <br></rows> <br> <br>Grid initialization works so far, but after editing a cell the value gets resetted imidiately to the old value. Why ? <br> <br>If I do not handle the onCellEdit event with my function, the new value is "saved" to the grid. <br> <br>So what Im doing wrong here ?



Thanks,



Andreas

Grid initialization works so far, but after editing a cell the value gets resetted imidiately to the old value. Why ?
You not returning “true” after setting new value, grid treat it as a signal to block edit operation and revet cell to old value

if (stage == 2) {
this.cells(rowId, cellInd).setValue(newVal);
return true;
}