0
<sjg:gridColumn name="orderLowPrice" title="Oder Low price" sortable="false" editable="true" edittype="text"/>

The above has to be a 7,4 decimal number basically with 3 digit max number and 4 decimal places.

how to set this rule in the grid column?

user3761541
  • 157
  • 2
  • 20

1 Answers1

1

I do not have the libraries loaded, but JavaScript has some basic numeric formatting in place. use toPrecision(7) or toFixed(4) to obtain your desired results.

toPrecision(7) will only show 7 digits total (truncating if necessary) toFixed(4) will only truncate the decimal to 4 digits.

I believe you can use formatter="formatNumber" in your column markup, and then the format function that it calls:

<sjg:gridColumn name="orderLowPrice" 
               title="Oder Low price" 
            sortable="false"        
            editable="true" 
            edittype="text" 
           formatter="formatNumber" />

...

<script>
    function formatNumber(number){
        return number.toFixed(4);
    }
</script>

you can also reference here for more formatting information: https://code.google.com/p/struts2-jquery/wiki/FormatGrid

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
Eric D
  • 506
  • 3
  • 10
  • @user3761541 What do you mean with that didn't work ? Any error ? What have you tried ? BTW, related: http://stackoverflow.com/a/22408093/1654265 – Andrea Ligios Sep 15 '15 at 08:13