Author Topic: Question about currency value display.  (Read 5047 times)

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Question about currency value display.
« on: June 05, 2014, 07:23:41 am »
Hi,

As our API, we can assign a data type for each column. And I have a problem, I have some columns' data type are "integer/float", I can display integer/ float value directly and also have some auto validation can avoid user input and letter or other invalid value.

But now I want to add number format (the thousands comma) for each value. So the problem is if I change my value as "5,000", it will be a string and can't display on an "integer/float" type cell. I know I can change the data type to "string", but it's mean I need to add some validation manually.

-----------------------------
I found "render" can solve my problem. And it works well now.



Thank you!
« Last Edit: June 05, 2014, 08:17:26 am by noctrona »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Question about currency value display.
« Reply #1 on: June 05, 2014, 08:18:02 am »
There is no need to change the format of the data. you can display the currency format in the view using column.render callback.

Live example:

http://paramquery.com/pro/demos/grid_json

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Question about currency value display.
« Reply #2 on: June 05, 2014, 08:29:37 am »
There is no need to change the format of the data. you can display the currency format in the view using column.render callback.

Live example:

http://paramquery.com/pro/demos/grid_json

Hi,

Yes. Already use this way to display currency. Thank you!

One more thing about formatCurrency. It looks we packaged the jquery method as a paramQuery method. So is that possible can add a parameter to set the separator sign. Because in different local, the separator have different. Some will use comma, some will use dot.

 
« Last Edit: June 05, 2014, 08:36:36 am by noctrona »