${fieldValue(be...">

Tries to remove commas from Long numbers in Grails app

I have this code:

    <g:link action="edit" id="${testObjectResults.id}">
               ${fieldValue(bean: testObjectResults, field: "id")}
   </g:link>

      

links create links, identification numbers, with commas in them; I don't want commas. I tried this.

   <g:link action="edit" id="${testObjectResults.id}">
          <g:formatNumber number="${fieldValue(bean: testObjectResults, field: "id")}"
                     type="number" minIntegerDigits="1" />
   </g:link>

      

But it didn't work. I am using Grails 2.3.9. I tried stuff from this page: http://grails.org/doc/2.3.9/ref/Tags/formatNumber.html but it doesn't work.

+3


source to share


2 answers


fieldValue

format the number itself, try this



<g:link action="edit" id="${testObjectResults.id}">
    ${testObjectResults?.id}
</g:link>

      

+4


source


you have 3 options:



  • specify @format

    :

    <g:formatNumber number="${number}" type="number" format="######"/>

  • specify @locale

    which does not use group splitting:

    <g:formatNumber number="${number}" type="number" locale="${Locale.GERMANY}"/>

  • set as the default Locale

    (which does not use group separation) for the entire application to get rid of commas everywhere

+1


source







All Articles