We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can one use NumberFormatOptions

Thread ID:

Created:

Updated:

Platform:

Replies:

149405 Nov 25,2019 12:57 PM UTC Nov 27,2019 09:15 AM UTC Vue 3
loading
Tags: Data Grid
Michael Kornatzki
Asked On November 25, 2019 12:57 PM UTC

Hi,
i am new to syncfusions conponents and am wondering how i should use NumberFormatOptions?

I want to format a Column. In the documentation for the ColumnModel i can see that one can set NumberFormatOptions (https://ej2.syncfusion.com/vue/documentation/api/grid/columnModel/#format)
But how can i use NumberFormatOptions?

Kind regards,
Michael

Pavithra Subramaniyam [Syncfusion]
Replied On November 26, 2019 05:32 AM UTC

Hi Michael, 
 
Thanks for contacting Syncfusion Support. 
 
You can set the number format for the Grid columns by setting the “column.format” property with format strings N, C and P. Please refer to the below code example and documentation link for more information. 
 
[App.Vue] 
<ejs-grid :dataSource="data"  height='315px'> 
   <e-columns> 
      <e-column field='OrderID' headerText='Order ID' textAlign='Right' width=90></e-column> 
      <e-column field='Freight' headerText='Freight' textAlign='Right' format='C2'></e-column> 
      <e-column field='OrderDate' headerText='Order Date' format='yMd' type='date'></e-column> 
   </e-columns> 
 </ejs-grid> 
 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


Michael Kornatzki
Replied On November 26, 2019 05:52 AM UTC

Hi Pavithra,

thanks for the answer but that was not the point.

The documentation (https://ej2.syncfusion.com/vue/documentation/api/grid/columnModel/#format) says that i can use NumberFormatOptions and i am interested in how to use NumberFormatOptions.

Kind regards,
michael

Pavithra Subramaniyam [Syncfusion]
Replied On November 27, 2019 09:15 AM UTC

Hi Michael, 
 
Thanks for your update. 
 
You can apply the NumberFormatOption for Grid columns as given below. Please refer to the below code example, documentation link and sample link for more information. 
 
[App.Vue] 
<template> 
  <div id="app"> 
    <ejs-grid id="Grid" ref="grid" :dataSource="data" :allowPaging="true"> 
      <e-columns> 
        <e-column field="OrderID" headerText="Order ID" width="90"></e-column> 
        <e-column field="Freight" headerText="Freight" :format="format" width="90"></e-column> 
        <e-column 
          field="ShipCity" 
          headerText="Telefon" 
          width="150" 
          textAlign="Center" 
        ></e-column> 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 
 
<script> 
.  .  . 
export default { 
  data() { 
    return { 
      data: data, 
      format:{ format:'C5' , useGrouping: false, 
minimumSignificantDigits:1, maximumSignificantDigits:3} 
    } 
  } 
}; 
</script> 
 
                              https://ej2.syncfusion.com/documentation/api/base/numberFormatOptions/ 
 
Sample               : https://codesandbox.io/s/vue-number-format-optoins-y75mq 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon