Forum


05:32

22/03/2009

I have a colModel
name:'cost',index:'cost', width:100, formatter:'currency', formatoptions:{decimalSeparator:'.', thousandsSeparator: ',', decimalPlaces: 2, prefix: '', defaultValue:''}, editable:true, edittype:'text', editoptions: {size:30, maxlength: 22}, editrules:{number:true}
}
It can shows '$1,400.20' at the table cell. But when I click edit using the modal form will also fill in '$1,400.20' in the input field. How can I control such that it will display '1400.20'?
09:42

Moderators
30/10/2007

Hello,
According to your code, this field should not contain "$" as prefix, since you set a prefix to be empty string.
Also the conversion should be done automatically if you use the build in formatters, so please look at your code again.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
10:15

22/03/2009

Do you mean that the formatter must be 'currency' for it to work properly? I tried to do something like:
amount: function(cellvalue, options, rowdata){
var op = $.extend(true, {}, options, {
currency: {
decimalSeparator:'.', decimalPlaces:2, suffix:'', prefix:', thousandsSeparator:',', defaultValue:' '
}
});
options.colModel.align = 'right';
return $.fn.fmatter.currency(cellvalue, op, rowdata);
}
});
so that I can simply use formatter:'amount' in colModel. I need to also specify an unformatter for cell edit?
17:42

Moderators
30/10/2007

Hello,
Just define the unformat function and everthing will be OK.
http://www.trirand.com/jqgridw.....r_function
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
32 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66