Hi Guys
I had a good look around on extjs and ext.net but don't see this one. Is there a list of all the formats and is one of them for (0,000.00) which would represent a negative number. This is an accountancy style format.
Regards
Printable View
Hi Guys
I had a good look around on extjs and ext.net but don't see this one. Is there a list of all the formats and is one of them for (0,000.00) which would represent a negative number. This is an accountancy style format.
Regards
Hello!
Sorry, I don't quite understand what exactly is your problem with format, can you provide more information. To format value to accountancy style you can use Ext.util.Format.currency and it works with negative values too: http://docs.sencha.com/ext-js/4-1/#!...ethod-currency
So... data from database would be say -1.23 the renderer should then turn that into (1.23)
Yes, you can customize Ext.util.Format to do this.
If you have more questions about this I think it will be easier if you will provide some example and we can give you the best solution.
I have checked out the docs and searched the forums etc and can't see any syntax or example of formatting negative numbers like this , can you give me a tested example of ext.util.format representing a negative number as (1234.00) E.g. database gives -1234.00 and ext.util.format gives the result of (1234.00)
I really don't think I need to start reposting my MVC example with a number column added for half a line of code.
Sorry, I misunderstood your requirement.
Unfortunately, there is no number format to do what you want but you can use the following overriding to remove negative sign:
Code:Ext.override(Ext.form.NumberField, {
setValue: function(v) {
if (v){
v = Ext.util.Format.number(v, '0,000.00');
v.replace(/^[+-]/, '');
}
return Ext.form.NumberField.superclass.setValue.call(this, v);
}
});
Thanks! i'll give it a try and let you know. Do you know if handling this type of formating will be included in the future?