PDA

View Full Version : Decimal number formatting problem in IE



shreshth.wadhwa
4 Aug 2013, 8:16 PM
Hi,
We have a gridPanel below and and editor is added on it.
Now I had a requirement to format the editable number to 2 decimal places.
this.vdaGridPanel = Ext.create("Ext.grid.Panel",{
selType:'cellmodel',
columns: this.pm.gridColumns,
id : 'detailedGridVDA',
height: this.height * 0.55,
width: this.width * 0.989,
overflowX: 'auto',
editor:{allowBlank:false},
layout: 'fit',
cls:'my-custom-gridCss',
tdCls : 'custom-column',
style:{
marginLeft:'10px'
},
listeners:
{
'edit': this.onItemEditEnd,

itemcontextmenu: Ext.bind(this.itemContextMenuHandler, this),
focus: Ext.bind(this.pm.cellFocusHandler, this.pm)
},
plugins:
[
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
beforeedit: function(obj,e) {
return vdaViewRef.pm.isGridEditable;
}
}
})
]
});

We formatted the number for the grid by the below method.
formatEditableCellValue:function(number)
{
var number = Number(number);
var retNumber=number;
if(number > 0 && number < 1)
{
retNumber = parseFloat(number).toFixed(4);
}
else{
retNumber = parseFloat(number).toFixed(2);
}
return retNumber;
}

This works fine on Google Chrome. But when we work with IE 8 on clicking the cell of grid, the formatting is not retained and the complete number gets displayed.
This happens on only few cells of my grid and not all. This always happens with the same cells only.
I have no code in beforeedit() method of the editor. Till beforeedit the values are formatted but as soon as the cell becomes editable the complete decimal values are displayed.
Please help me solve this issue.

Gary Schlosberg
7 Aug 2013, 4:02 PM
Generally one has better likelihood of responses from the community if one can include a working test case for others to understand and experiment with.