How can I format an integer column without comma separator?
Hi Dean,
This is an initial update to let you know that I have received your inquiry. I will look into this for you and will have an update on or before Thursday.
For this you can use the 'format' option which you can set on the colum. The 'format' option applies for number datatypes and can be set to format as a'number; currency; percent; int; double, etc. You set it like this:
columns: [
{ headerText:
"Product ID"
, key:
"ProductID"
, dataType:
"number"
, format:
},
"Production Date"
"ProductionDate"
"date"
"ddd, MMM-d-yy HH:mm"
]
You can see more on this by referencing tbe API (
http://help.infragistics.com/jQuery/2013.1/ui.iggrid)--> Options -> Columns -> Format
Let me know if you need any additional assistance.
Hi Troy,
Your suggested solution does not works. Here is the link to the image to show the result. http://sdrv.ms/18nfL7E
Thanks,
Dean
Yes, I see the issue...
What you can do use use a column 'formatter' and strip-out the "," comma seperator.
For example, you can try the following:
function formatNumber (val) { if (typeof val !== "number" || isNaN(val)) { return "Not set"; } return "$" + val.toString().replace(/\,/g,'');
}
.....and then set the formatter in your column settings:
columns: [ { headerText: "Number", key: "Number", formatter: formatNumber} ]
This should do the trick to strip out the comma from the integer column. Let me know if you need any additional assistance.
Thanks!
Hi drchip,
I am pleased to see that you found a solution. Let us know if you need any additional assistance!
I found a solution. Just remove dataType and format.
{ headerText: 'Id', key: 'ID', width:'50px' }
Formatter approach does not work either. The val variable is a number type so there is no comma to strip even if you toString the value.
http://sdrv.ms/12zjR8i