EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: binte.hava on March 06, 2014, 11:00:43 AM



Title: How to use prefix $ in edatagrid cell field price
Post by: binte.hava on March 06, 2014, 11:00:43 AM
Hi!
I have seen prefix can be used in the input box for using currency signs but how to use it in edatagrid cell I dont know. I have a column two with the price filed. I want that when the values from db come they should be displayed as 7.89$ and when these values are saved to db than only 7.89 should be passed

The edatagrid code is :

<table id="dg_userspecific_stoneVariable" title="WORKSHEET" style="width:791px; height:427px;"
         toolbar="#toolbar" pagination="false" idField="id"
         rownumbers="false" fitColumns="false" singleSelect="true">
   
      <thead>
         <tr>
            <th width="630" field="name"></th>
            <th width="157" field="price" editor="{type:'numberbox',options:{precision:2}}"></th>
            
         </tr>
      </thead>
   </table>

I want to use the $ with the field price. Kindly tell me i am stuck :( dont know how to do...??


Title: Re: How to use prefix $ in edatagrid cell field price
Post by: stworthy on March 07, 2014, 12:07:57 AM
Please declare a 'formatter' function on a column to format the value before displaying it in the grid.
Code:
<th data-options="field:'price',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}},formatter:function(value){return value+'$'}">List Price</th>


Title: Re: How to use prefix $ in edatagrid cell field price
Post by: binte.hava on March 07, 2014, 01:21:54 AM
Thanks  :) Its working perfectly.