Overriding/Extending Ext.util.Format
I have tried the following but it breaks when using the Ext.Template class
Ext.override(Ext.util.Format, {
ukMoney : function(v){
v = (Math.round((v-0)*100))/100;
v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
v = String(v);
var ps = v.split('.');
var whole = ps[0];
var sub = ps[1] ? '.'+ ps[1] : '.00';
var r = /(d+)(d{3})/;
while (r.test(whole)) {
whole = whole.replace(r, '$1' + ',' + '$2');
}
v = whole + sub;
if(v.charAt(0) == '-'){
return '-£' + v.substr(1);
}
return "£" + v;
}
});
I want to be able to use the following in my column models. renderer: Ext.util.Format.ukMoney and the following in my templates. {template_var:ukMoney}
The error returned in firebug is:
p is undefined
chrome://firebug/content/blank.gifExt={version:"2.1"};window["undefined"]=...new Date()).getTime()-this.getTime())};
You can set properties in it....
#If you have any other info about this subject , Please add it free.# |