SpNg
24 Jan 2011, 11:43 AM
I saw this was not in Touch right now, but is pretty helpful. It's a quick function for adding commas to numbers in templates. You use it in a template just like other formatting options i.e. {number:addCommas}
Enjoy.
Ext.util.Format.addCommas = function (str) {
str = str.split('.');
while(str[0] != (str[0] = str[0].replace(/(\d+)(\d{3})/, '$1,$2')));
return str.join('.');
}
Enjoy.
Ext.util.Format.addCommas = function (str) {
str = str.split('.');
while(str[0] != (str[0] = str[0].replace(/(\d+)(\d{3})/, '$1,$2')));
return str.join('.');
}