Forum


22:00

14/06/2010

Hi,
I'm using v3.6.5 and it works great. But I have a problem with my number formats. My system is in spanish and I'm loading the spanish localization and using formatter to get the grid data displaying correctly - so far so good.
I'm using formatter in my colModel and all my floats display fine with a comma decimal separator (e.g. 12,53). When I come to edit or add new rows, the data displayed in the popup form shows floats with a dot seperator (e.g. 12.53).
If I enter numbers in the edit form with the dot decimal separator e.g. 12.53 - they are displayed correctly in the grid e.g. 12,53.
If I enter data in the form with the comma separator, I get a validation error (from formatter I guess) that the field is not numeric.
What do I need to do to ensure that my form displays and validates numbers with a comma decimal seperator.
P.S. My data is not bound I use a dummy fille for the editurl and set reloadAfterSubmit:false on edit
11:15

Moderators
30/10/2007

Hello,
You can avoid this, suppessing the checking und use your own formatter and unformatter to return the original value.
The reason that you have a error when you enter a number with decimal separator "," is that the javascript isNaN function work only with numbers that have decimal separator ".".
Also you can define your own validator for your number.
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.
20:58

28/01/2012

I am having the exact same issue.
if( !(rqfield === false && this.isEmpty(val)) ) {
if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
}
if(isNaN(val.replace(opts.decimalSeparator,".")))
Be a better check? or is there someway to run unformat on this before is runs the saverow function?
I would think you would re-run unformat after the user edits the data for a row.
if(edtrul) {
if(!nm) { nm = g.p.colNames[valref]; }
if(edtrul.required === true) {
if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; }
}
// force required
var rqfield = edtrul.required === false ? false : true;
if(edtrul.number === true) {
if( !(rqfield === false && this.isEmpty(val)) ) {
if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
}
Most Users Ever Online: 715
Currently Online:
25 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