2011/2/4 jemptymethod <[email protected]>: > I'm setting ExtJS form values in one of their ubiquitous config > objects based on JSON data from an Ajax call. > > For currency fields I am calling "toFixed(2)" on the numbers such as: > > jsonObj.shippingAndHandling.toFixed(2) > jsonObj.totalDueToday.toFixed(2) > > Etcetera > > But I have a requirement to default a particular field to 0.00 and > when I specify 0.00 as the value in the config object, it shows up as > 0 in the UI > > As a work around instead of trying to specify 0.00 I can pass the > following and it successfully renders 0.00 in the UI > > (new Number(0)).toFixed(2)
You can either use (0).toFixed(2) There is maybe a speed difference between the two (hard to tell which is faster), but I wont think about speed here, but then number of trasferred bytes is less for sure. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
