PDA

View Full Version : Allowing blank / null in EditorGridPanel for 'float' column



matt4447
25 May 2009, 1:14 PM
Hi,

I have a grid with a number of columns whose data type are 'float'. The editor associated with each column is fm.NumberField and the renderer is Ext.util.Format.usMoney.

I want to be able to specifically null / blank out cells that previously may have had a value in them, but currently the behavior is that '' produces a 0 cell value in my format function.

My first shot at tackling the problem was with declaring following code and specifying it as the renderer for my column:

MyCode.util.Format.usMoneyNull = function(val) {
if (val == null) {
return '';
} else {
return Ext.util.Format.usMoney(val);
}
}

But, since val is 0 even when the editor input was '' it seems that the behavior I need to override is somewhere previous to the renderer being called.

Can anyone help point me to what behavior I need to override in order to allow null values to be specified for a 'float' column cell?

Thanks,

Matt

crxtech
3 Dec 2009, 12:03 PM
I'm having the same problem. Did you ever figure it out?

I'm using, which works for returning the blanks, instead of $0.00, but doesn't work for the usMoney format?

// custom renderer function
function allowBlank(val){
if(val > 0){
return Ext.util.Format.usMoney(val);
}else {
return '';
}
}

Use:

{id:'fy7', header: "fy7", dataIndex: 'fy7', summaryType: 'sum', hidden:true, renderer: 'allowBlank', width:80},