yui datatable inline cell editor problem
- by Eli
Hi,
When using inline cell editor in my datatable I want to round value to 10 multiple
This is my code :
mydatatable.subscribe("cellDblclickEvent",datatable_DetailsCommande.onEventShowCellEditor);
var onCellEdit = function(oArgs) {
var oColumn=oArgs.editor.getColumn();
var column=oColumn.getKey();
var oRecord = oArgs.editor.getRecord();
var newValue=oRecord.getData(column);
var row = this.getRecord(oArgs.target);
// calculate the modulo
n = newValue % 10;
if(n!=0)
{
newValue=parseInt(newValue);
oRecord.setData(column,eval(newValue+(10-n)));
}
}
mydatatable.subscribe("editorSaveEvent", onCellEdit);
Function result :
After double clicking in cell I change value to 17 for example and I click save, I want then to have 20 in my datatable cell but I got 17. After second time double clicking in my datatable cell I obtain 20 in the inline cell editor.
How to put the rounded value in my datatable cell?
regards,