Forum

May 22nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

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

Topic RSS
not exact grouping (case insensitive or grouping by intervals of values)
22/04/2013
20:30
OlegK
Germany
Member
Forum Posts: 1233
Member Since:
10/08/2009
Offline

Hello Tony,

I answerd just now on the following question on the stackoverflow. The question was about case insensitive grouping. I remember before about close "not exact grouping" like grouping my year of by month and year instead of exact date values.

It seems to me that canging just one line of code allow to implement all the requirements. I suggest to change the line of code

if( typeof v !== "object" && grp.lastvalues[i] !== v ) {

to the following

if (typeof v !== "object" &&
        ($.isFunction(grp.isInTheSameGroup) ?
         !grp.isInTheSameGroup(grp.lastvalues[i], v) :
grp.lastvalues[i] !== v)) { 

after that one could define groupingView with additional callback function isInTheSameGroup for example like the following

grouping: true,
groupingView: {
    ...
    groupField: ["name"], // the column by which we group
    isInTheSameGroup: function (x, y) {
        return String(x).toLowerCase() === String(y).toLowerCase();
    }

The demo demonstrates the results. It displays the results like below

I don't tested grouping of multilevel, but I hope it should work too.

I think that implementation of the feature could be intresting for other users of jqGrid.

Bes regards
Oleg

24/04/2013
14:13
OlegK
Germany
Member
Forum Posts: 1233
Member Since:
10/08/2009
Offline

Hello Tony

The pull request contains very simple changes in grouping module of jqGrid (one line was modified and tree lines was added), but it implement more advanced version of grouping.

The demo demonstrate the results which look like

Best regards
Oleg 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
34 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1233

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11320

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10527

Posts: 31121

Newest Members: Shahid1, sheryl.liang@db.com, JuanPC, Loganathan.S, krish, jqGridForStruts

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

Administrators: admin: 61

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information