Hi Team
I am looking for very urgent quick help
i have columns applied currency format, is there any way to have one column with two decimal which is default but another column with three decimal and another with four decimal.
I understand that $.ig.regional.defaults i have to set min/max value for currency, suppose i set min to 0 and max to 9 and but how can we set dynamically column decimal value to according to my need for each column.
How can I achieve that.
I felt $.ig.formatter this can help me but didn't understand this function completely, since its not mentioned any documentation can you help me to understand this function.
I tried this but didn't worked $.ig.formatter(9332.44567889, "number", "currency",null,null,'0.00')
Your ASAP response will be very helpful for me.
Thanks
Hi
also i don't want to loose any datatype due to filter and sorting
Hi team
can Please help me on that....
HI Team
Its very disappointing. I am using your licensed version and hence expecting a response from you ASAP. i have some client deliverable which is getting delayed because i am not getting any response from Team.
It will be very help full you Response on this ASAP.
Hello ptilwani,
Thank you for posting in our community.
As you assumed formatter function will help you achieve your requirement. As mentioned in our API documentation formatter is a reference to a function(string or function) which will be used for formatting the cell values of particular column. The function should accept value and return new formatted value.
I made a small sample illustrating how your requirement could be achieved using formatter option of the columns. Since formatter is set per column you can format every column differently and get the look and feel that you are looking form. In my sample I am using 3 formatter to return the values with 2,3 and 4 decimal placed. In this scenario data type number is preserved and sorting and filtering behavior are working as expected for this type of data For example:
[code]
$("#grid").igGrid({ columns: [ { headerText: "Name", key: "Name", dataType: "string" }, { headerText: "Age", key: "Age", dataType: "number" }, { headerText: "Price1", key: "Price1", dataType: "number", formatter: function (val, data) { return "$" + val.toFixed(2) } }, { headerText: "Price2", key: "Price2", dataType: "number", formatter: function (val, data) { return "$" + val.toFixed(3) } }, { headerText: "Price3", key: "Price3", dataType: "number", formatter: function (val, data) { return "$" + val.toFixed(4) } } ], dataSource: data //JSON Array defined above });
[/code]
I am also attaching my sample for your reference.
Please keep in mind that according to our Support Policy the response time for your cases and forum posts depends on the support level that you have. In you scenario the support level is "Standard" which means that the actual response is expected within 3 business days. If you would like to take advantage of our Priority support and receive responses with 24 ours please contact our sales department at: sales@infragistics.com
Thank you for using Infragistics components.
Hi Vasya
Thank you for response and help.
I understand regarding your supportlevel point but i started this thread on 28 September my local time and today is 1st October, my client deliverable was getting delayed.
any way this helps me thanks for help if any doubt will post you.
Thank you
i tried your solution its work but what about currency formatting for example if i use formatter i loose the thousand separator formatting, also i want to ask how localization we can managed here.
Hello Vasya
I tried your solutions and its worked great in decimal places, thanks for your help but in this solution i am loosing currency group separator as well as negative currency format. i did some googling and come with this solution(attached).
but i am curious is there any great (infragistic) way to do that.
Thanks and Regards
I am glad that you find this suggestion helpful.
This suggested change in regional settings could have effect if you are using the regional settings anywhere else in your application. For example, if you have another igGrid used in your application it will use the modified regional settings.
If you would like to keep the default settings for other aspects of the application you could reset the default value of the decimals back to 2(which is the default value) after you are done.
Please let me know if you need any further assistance with this matter.
Hi Maya
one small question as you said we have to change default setting and and use formatter. since we are changing default settings is this will effect any where else too?
Thanks Maya
so appreciated, that's i was looking for i have thought but how to implement that's your suggestion shows me a light and bring me on right direction.
Thank you so much....
i will try your solution and if any doubt i will post you.. but looks it will work for me...
Thank you!!!
You could also use the $.ig.formatter function if you don’t want to lose the other default regional formatting settings. However in that case you would need to modify the currencyMaxDecimals and currencyMinDecimals options since the formatter function uses them to specify the number of decimals to show.
Here’s an example:
{ headerText: "Price1", key: "Price1", dataType: "number", formatter: function (val, data) {
$.ig.regional.defaults.currencyMaxDecimals = 2;
$.ig.regional.defaults.currencyMinDecimals = 2;
return $.ig.formatter(val, "number", "currency");
}
},
{ headerText: "Price2", key: "Price2", dataType: "number", formatter: function (val, data) {
$.ig.regional.defaults.currencyMaxDecimals = 3;
$.ig.regional.defaults.currencyMinDecimals = 3;
} ,
{ headerText: "Price3", key: "Price3", dataType: "number", formatter: function (val, data) {
$.ig.regional.defaults.currencyMaxDecimals = 4;
$.ig.regional.defaults.currencyMinDecimals = 4;
With the above settings the “Price1” column will show a currency value with 2 decimals. “Price2” will show a currency value with 3 decimals and so on.
I’ve attached a modified sample for your reference. Let me know if you have any questions.
Best Regards,
Maya Kirova
Product Developer
Infragistics, Inc.
https://ko.infragistics.com/support