Currency Mask jqgrid

Go To StackoverFlow.com

0

I am new to jqGrid, and having trouble with achieving a couple of tasks. Any guidance will be a huge help.

Issue1# I need to perform following jquery masking on my rate field in the create form,

$('#Rate').priceFormat({ prefix: '', thousandsSeparator: '' }); How could I achieve this in jqGrid?

Thanks a lot.

This is what I have right now:

JQGridColumn RATEColumn = CapitationsGrid.Columns.Find(c => c.DataField == "RATE");
            RATEColumn.Editable = true;
            RATEColumn.EditType = EditType.TextBox;
            RATEColumn.EditDialogLabel = "Rate";
            RATEColumn.DataType = typeof(float);
            RATEColumn.EditClientSideValidators.Add(new RequiredValidator());
            RATEColumn.EditClientSideValidators.Add(new NumberValidator());
            RATEColumn.Formatter = new CurrencyFormatter
            {
                DecimalPlaces = 1,
                DecimalSeparator = ".",
                Prefix = "$",
                Suffix = " USD",
                ThousandsSeparator = ","
            };
2012-04-04 19:25
by OBL


1

It's important to understand, that jqGrid try to separate the data from the visualization. So If you need to display currency for example you should fill numbers in the input data and use predefined of custom formatters to display the currency in format which corresponds the locale which you need.

To format currency you should use formatter: 'currency', formatoptions: {thousandsSeparator: ""} (see the documentation). The default values of formatoptions of the currency formatter you will find in the locale file like grid.locale-en.js which you use.

2012-04-04 19:38
by Oleg
I am using the custom formatter, but it only works in the grid view, I need it to be working in the edit forum too - OBL 2012-04-04 19:41
They don't have method for a formatter method alike EditClientSideValidators - OBL 2012-04-04 19:43
@OBL: An example will be clear all. The problem that there are too many possibilities how you can implement this. In general jqGrid has special formatCell function only for cell editing (see here). In form editing the raw unformated data will be displayed. Are you original source data have some thousands separator? In any way you can modify the data as the beginning of editing inside of dataInit part of editoptions - Oleg 2012-04-04 19:51
This is what I have, may you please elaborate on what you are referring to? I am really new to this. Thanks - OBL 2012-04-04 20:10
Please see the post for cod - OBL 2012-04-04 20:11
@OBL: First of all I see not that you use not open source JavaScripp library jqGrid. You use some commercial product which are build based on it. Compare this with this for example. So it's difficult for me to help you. What I wont to point is it's important which JSON data you use to fill the grid. Are the data pure numbers? Are the data correct formatted in the grid? How the data looks like in the Edit form? All this is unclear from the code which you posted - Oleg 2012-04-04 20:19


0

This covers your problem. Have a look.

name: 'Currency',

width: 75,

formatter: 'currency',

formatoptions: { decimalSeparator: '.', decimalPlaces: 1, suffix: ' USD', thousandsSeparator: ',', prefix: '$' }

http://www.guriddo.net/demo/guriddojs/functionality/formatters_built_in/index.html

2017-11-17 05:44
by Dulith De Costa
Ads