Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
False Sorting of Integer with thousandsSeparator
03/09/2009
06:42
Avatar
Juergen
Guest
Guests

Hello!

I am using grid.locale-de.js - if i set a dot as thousandsSeparator:

formatter:{integer:{thousandsSeparator:".",defaultValue:"0"}

The Numbers are sorted in false order e.g. 0,1021,213 indstead of 0,213,1021

If i use an other thousandsSeparator like space " " the numbers are sorted correct.

Can anybody help me

Juergen

04/09/2009
05:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Do you have set in colModel the property sorttype of that column, this is needed when we use local data

http://www.trirand.com/jqgridw.....array_data

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.

04/09/2009
09:52
Avatar
Juergen
Guest
Guests

Hello Tony,

the sorttype in colModel is set to "int":

jQuery(document).ready(function(){   

tableToGrid('#irgendwas',
{ height:370,
colNames:['Artikelnummer','Bezeichnung1', 'Bezeichnung2', 'Bezeichnung3','Bestand','Abfragedatum'],

colModel:[
{name:'Artikelnummer',index:'1', width:"115", sorttype:"int",align:'right'},
{name:'Bezeichnung1',index:'2'},
{name:'Bezeichnung2',index:'3'},
{name:'Bezeichnung3',index:'4'},
{name:'Bestand',index:'5', sorttype:'int', width:"90", formatter:'integer',align:'right'},
{name:'Abfragedatum',index:'6', sorttype:"date"}],
autowidth:true});

Regards

Juergen

04/09/2009
10:59
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

The problem is in $.unformat:

stripTag = eval("/"+op.thousandsSeparator+"/g");
ret = $(cellval).text().replace(stripTag,'');

If op.thousandsSeparator is ".", that replaces the entire text with '' (the pattern becomes /./g which matches everything).

Looks like something along the lines of:

var sep = op.thousandsSeparator.replace(/([\\.\\*\\(\\)\\{\\}\\+\\?\\\\])/g,"\\\\$1");

stripTag = new RegExp(sep, "g");

should do the trick. I think that covers all the special chars. An alternative would be:

sep = op.thousandsSeparator.replace(/([^\\w\\s])/g,"\\\\$1");

That should guarantee to hit all the chars that need quoting - but also hits a few that dont.

04/09/2009
14:07
Avatar
Juergen
Guest
Guests

markw65 said:

Looks like something along the lines of:

var sep = op.thousandsSeparator.replace(/([\\.\\*\\(\\)\\{\\}\\+\\?\\\\])/g,”\\\\$1″);

stripTag = new RegExp(sep, “g”);

should do the trick.

Yes! It does the trick.

Thanks a million!Laugh

Juergen

08/09/2009
08:32
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks. Already fixed in in 3.5.3 Release.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
22 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information