:: Forum >> Version 2 >>

Formats applied to empty cells ANYWAY?

More information on this topic is available in the documentation section: /aw.formats.number/settextformat.html.

Hi,

i've set a currency format
var money = new AW.Formats.Number;
money.setTextFormat(\"#.###,##\");
 
and applied it to a specific column (say, column #2)

obj.setCellFormat(money2);
 
Now, if any of the cells from column 2 is empty, or filled with blanks, the format is applied anyway, resulting in the cell showing "0,00" instead of null as I'd like.

What am I doing wrong?

Thanks, ciao

Diabolik
Diabolik
Tuesday, February 28, 2006
Ignore the backslashes (coming from the fact that I'm generating this code with PHP):

var money = new AW.Formats.Number
money.setTextFormat("#.###,##"); 
obj.setCellFormat(money2); 
 
Diabolik
Wednesday, March 1, 2006
Anybody with a solution yet?
Heeeelp!!

Diabolik
Diabolik
Friday, March 3, 2006
I guess I should add special case for null or empty values but for now you can just modify formatting method -

var money = new AW.Formats.Number
money.setTextFormat("#.###,##"); 

money.dataToText1 money.dataToText;
money.dataToText = function(data){
    return 
data ? this.dataToText1(data) : "";
}

obj.setCellFormat(money2);  


 
Alex (ActiveWidgets)
Friday, March 3, 2006
Thanks Alex, it works perfectly!
Ciao,

Diabolik
Diabolik
Sunday, March 5, 2006
I have the same problem with Date format but the grid displays #ERR whent the cell is empty.

Alex I tried your work around but it gives me a Stack overflow error
on large data sets 1000+ (not really that large)

Colin P
Friday, March 10, 2006



This topic is archived.

Back to /aw.formats.number/settextformat.html

Documentation:

Forum search