yui datatable inline cell editor problem
Posted
by Eli
on Stack Overflow
See other posts from Stack Overflow
or by Eli
Published on 2010-03-31T10:25:54Z
Indexed on
2010/03/31
17:53 UTC
Read the original article
Hit count: 646
yui
|yui-datatable
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,
© Stack Overflow or respective owner