EasyUI Forum
December 03, 2020, 09:15:56 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: Thousand separator in datagrid column in cell editng mode  (Read 87 times)
jahangir
Newbie
*
Posts: 42



View Profile Email
« on: November 19, 2020, 06:53:43 AM »

How to use thousand separator in datagrid column in cell editng mode.

I use this code it shows thousand separator after loading data and on begain edit but after edit thousand separator disappears from edited cell.

Code:
<th data-options="field:'listprice',width:80,align:'right',editor:{type:'numberbox',options:{precision:0, groupSeparator:','}},
      formatter:function(value, row){
            var number = row.listprice;                                   
            return number.toLocaleString('en-US', {minimumFractionDigits: 0});
                                    }
 ">List Price</th> 


Please check following example code.

http://code.reloado.com/jbhatti/34/edit#html,live
Logged
jarry
Administrator
Hero Member
*****
Posts: 1906


View Profile Email
« Reply #1 on: November 19, 2020, 11:31:54 PM »

Please call 'parseInt' function to convert field value to an integer.
Code:
formatter:function(value, row){
    var number = parseInt(row.listprice);                                   
    return number.toLocaleString('en-US', {minimumFractionDigits: 0});
}

This is the updated example.

http://code.reloado.com/jbhatti/35/edit#source
Logged
jahangir
Newbie
*
Posts: 42



View Profile Email
« Reply #2 on: November 20, 2020, 01:47:55 AM »

Thank's Jarry
Its working now as expected.
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!