Ajax DataGrid Support Product Page
How do you format a column value for currency?
Asked 14 Aug 2013 17:25:14
1
has this question
14 Aug 2013 17:25:14 Steve Skinner posted:
There are several options for "format" in the extension panel when setting up the datagrid, but how would one format a column value for currency? Replies
Replied 14 Aug 2013 20:28:47
14 Aug 2013 20:28:47 Steve Skinner replied:
I have stumbled upon the solution myself, so here it is in case someone else needs this. Just to be clear, this is a solution in classic ASP for applying US currency format to fields in the datagrid. I have not tried this in PHP...
It's actually really simple. After you've created your datagrid, you just need to make a simple modification to the file used for your datagrid in the ajax_servers folder created by the extension. Just put "FormatCurrency" in the empty quotes for the line of code in your dmx_grid file that applies to the field you want US currency formatting.
So, for example, my datagrid created the file dmx_grid3.asp in the ajax_servers folder. I can see this in the code of the page where I inserted the datagrid.
When opening dmx_grid3.asp, the first 20 lines of code or so contain all the fields used in my datagrid. One of them is for price and that's the one I want formatted for US currency. The line of code for this field looks like this:
After the change for currency formatting, this line looks like this:
Save the file, upload to server and refresh your datagrid page in the browser and you're done!
It's actually really simple. After you've created your datagrid, you just need to make a simple modification to the file used for your datagrid in the ajax_servers folder created by the extension. Just put "FormatCurrency" in the empty quotes for the line of code in your dmx_grid file that applies to the field you want US currency formatting.
So, for example, my datagrid created the file dmx_grid3.asp in the ajax_servers folder. I can see this in the code of the page where I inserted the datagrid.
When opening dmx_grid3.asp, the first 20 lines of code or so contain all the fields used in my datagrid. One of them is for price and that's the one I want formatted for US currency. The line of code for this field looks like this:
array("Price", "", false),_
After the change for currency formatting, this line looks like this:
array("Price", "FormatCurrency", false),_
Save the file, upload to server and refresh your datagrid page in the browser and you're done!