EasyUI Forum
September 14, 2025, 03:38:48 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to use prefix $ in edatagrid cell field price  (Read 7332 times)
binte.hava
Newbie
*
Posts: 5


View Profile
« 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 Sad dont know how to do...??
« Last Edit: March 06, 2014, 10:37:53 PM by binte.hava » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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>
Logged
binte.hava
Newbie
*
Posts: 5


View Profile
« Reply #2 on: March 07, 2014, 01:21:54 AM »

Thanks  Smiley Its working perfectly.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!