I guess there is something else in your code which breaks editing - it seems very unlikely that it is related to cell text source function. Maybe you could post an example which shows how to reproduce this?
obj.onCellTextChanged = function(text, col, row){
label.setControlText("Cell text changed - text: " + text + ", col: " + col + ", row: " + row);
}
// validating (Enter)
obj.onCellValidating = function(text, col, row){
var value = Number(text);
if (!(value > 100) || !(value < 1000)) {
label.setControlText("Invalid value - " + text + ", should be between 100 and 1000");
return true;
}
}
Change obj.setCellText(function(i, j){return oTable.rows.item(j).cells.item(i).innerText});
to: obj.setCellText(function(i, j){return oTable.rows.item(j).cells.item(i).textContent});
Paulo Cesar (PC from Brazil)
Wednesday, January 2, 2008
Hi Paulo, textContent does not give the HTML table cell content back, it gives "undefined" as reply in the grid.
innerText gives the cell content correctly, but then the cell edit function seems blocked.
Andre
Thursday, January 3, 2008
for me textContent works and your way gives undefined. (running in firefox)
You can't modify the the data like you trying to do.
To do that (in both browser, firefox and ie), change the functions: obj.setCellText(function(i, j){return (AW.browser == "ie") ? oTable.rows.item(j).cells.item(i).innerText : oTable.rows.item(j).cells.item(i).textContent});
i just noticed on IE u can just modify the cell 0,0 (works for every cell on firefox), maybe its a bug, ill try to figure it out.
Paulo Cesar (PC from Brazil)
Thursday, January 3, 2008
Hi Paulo, I can conform this behaviour, cell 0,0 works OK with my testcode, others are blocked. (I Use IE)
Andre
Thursday, January 3, 2008
I would use a table to array conversion for that. var oTable = document.getElementById('test');
var RowsLength = oTable.rows.length;
var CellsLength = oTable.rows.item(1).cells.length;
var mysource = new Array(oTable.rows.length);
for (k=0;k<RowsLength;k++){
mysource[k]= new Array(oTable.rows.item(1).cells.length);
for (m=0;m<CellsLength;m++){
mysource[k][m]=oTable.rows.item(k).cells.item(m).innerText;
}
m=0;
}
obj.setCellText( mysource );
HTH
Carlos
Thursday, January 3, 2008
Yeah i would do that too, but the behaviour listed here still an bug.
The exception hapens in this[getProperty] = function(p, a, b, c){
defined in system/control.js, for some reason the object doenst have the property _cellModel.
The Interesting thing: If you edit ONLY and ONLY cell 0,0 will always work, if you edit cell 0,0 and try edit other cell, the cell 0,0 will not work anymore.
Only Alex can discover what happening.
Paulo Cesar (PC from Brazil)
Thursday, January 3, 2008
Another interesting thing:
If you use only KEYBOARD to edit, all cell works, so maybe is with the event "dbclick", getting wrong obj (not the grid).
Paulo Cesar (PC from Brazil)
Thursday, January 3, 2008
OK, thanks for the help. I have implemented the workaround of carlos (thanks Carlos) and that helps me further on the job.
Would be nice if Alex is going to fix this bug.
Andre
Thursday, January 3, 2008
Andre,
it seems that the IE table rows collection item() method breaks when an argument is a string and not a number. Normally the AW indices are strings and this raises exception in editing code. You can fix your original function this way -