Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






not exact grouping (case insensitive or grouping by intervals of values)

UserPost

20:30
22/04/2013


OlegK

Germany

Member

posts 1210

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

14:13
24/04/2013


OlegK

Germany

Member

posts 1210

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 


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

215


Currently Online:

tony

stapelchip

110 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 10277

Posts: 30378

Membership:

There are 11047 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1210

markw65 – 179

kobruleht – 144

phicarre – 132

YamilBracho – 124

Renso – 118

Administrators: admin (60 Posts)

Moderators: tony (7390 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information