I find the question very interesting. I suggest don't implement the Globalize plugin. Here and here you can find additional information about it.
The usage will be simple. One should define custom formatter which uses Globalize.format
and unformatter which uses Globalize.parseFloat
functions. For example
formatter: function (v) {
// uses "c" for currency formatter and "n" for numbers
return Globalize.format(Number(v), "c");
},
unformat: function (v) {
return Globalize.parseFloat(v);
}
For more comfort I would recommend to define numberTemplate
and currencyTemplate
for example like
var numberTemplate = {align: 'right', sorttype: 'number', editable: true,
searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni']},
formatter: function (v) {
return Globalize.format(Number(v), "n");
},
unformat: function (v) {
return Globalize.parseFloat(v);
}},
currencyTemplate = {align: 'right', sorttype: 'number', editable: true,
searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni']},
formatter: function (v) {
return Globalize.format(Number(v), "c");
},
unformat: function (v) {
return Globalize.parseFloat(v);
}};
and use there in colModel
like
{ name: 'amount', index: 'amount', width: 150, template: currencyTemplate },
{ name: 'age', index: 'age', width: 52, template: numberTemplate },
The demo uses "en-IN" locale and display results like on the picture below