Accessing Old Value
Hi,
What is the best way to revert a cell back to the original value in onCellValidated()?
I use onCellValidating() to ensure the cell value is decimal. Then, I use onCellValidated() to push the value out to the db. Obviously, for whatever reason, there may be an error on the server side. (I simplistically push back "SUCCESS" or "FAIL". No large XML returned.)
On fail, I want to revert (the js array and the grid) to the old value. How do people do this?
Basically, I have:
myGrid.onCellValidating = function(text, column, row) {
if ( !isDecimal( text, false ) ) {
alert( 'ERROR: Value is not decimal. Please correct value or hit <ESC> to cancel.' );
return 1;
}
oldValue = myData[row][column];
}
myGrid.onCellValidated = function(text, column, row) {
var r = new AW.HTTP.Request;
r.setURL("editCommissionDefaultSingle.asp");
r.setRequestMethod("POST");
r.setParameter("SID", myData[row][0] );
r.setParameter("GID", myGID);
r.setParameter("FC" , myHeaders[column] );
r.setParameter("DP" , text );
r.request();
r.response = function( data ) {
if ( data != "SUCCESS" ) {
// restore old value
}
}
}
Paul Tiseo
April 14,