grails number (double) format in view -
i'm new grails (2.2.0) , seek figure out how format double values in views. have lot of them hence prefer code in 1 of config files if possible.
all values in views formatted g:field ... type="number" ...
in resources.groovy have this
beans = { localeresolver(sessionlocaleresolver) { defaultlocale= locale.english locale.setdefault (locale.english) } }
and in messages.properties used
default.number.format=#'###'###.#
i don't need i18n. deleted other files in there.
this problem in views only. info persisted correctly.
here examples want views:
input 10 output 10
input 0 output 0
input 0.775 output 0.775
input 0.7 output 0.7
input 1234567.12345 output 1'234'567.12345
the lastly illustration not standard format english. instead of one thousand seperator , want '
i thought if use
default.number.format=#'###'###.#
i don't need format every value g:formatnumber.
i appreciate help. in advance!
edit
here questions:
why default.number.format=#'###'###.# not work in messages.properties?
for illustration have in view:
<g:field name="mydouble" size="8" maxlength="20" type="number" value="${fieldvalue(bean: myinstance, field: 'mydouble')}"/>
how utilize g:formatnumber tag on field. have read grails documentation have problems understanding it.
i wrote i'm beginner , hence it's possible i'm missing knows grails quite obvious.
try using fieldvalue
when rendering numbers in gsp.
<g:field value="${fieldvalue(bean: personinstance, field: 'minprice')}" />
not sure if problem not using defaults or not because you're missing details question. shot in dark here.
grails view formatting numbers
No comments:
Post a Comment