Sorting grid with groups

467 views
Skip to first unread message

Adam Gruszynski

unread,
Mar 21, 2013, 6:02:45 PM3/21/13
to slic...@googlegroups.com
I have a single group going on.  When I sort a column, it sorts the data within the groups fine, but then reorders the groups as well so that in descending sort, it will place the group with the largest value as the first group.  It doesn't work that way in example 5.  There, when sorting, the groups stay put and the data is just sorted within.  Any idea why my implementation would be behaving differently?  Using the latest versions of your code.

Thanks,
Ag

Adam Gruszynski

unread,
Mar 21, 2013, 6:05:44 PM3/21/13
to slic...@googlegroups.com
Sorry, I meant the grouping example, not example5...

Michael Leibman

unread,
Mar 21, 2013, 6:06:14 PM3/21/13
to slickgrid
If you want the groups to be sorted explicitly, specify a "comparer" in the .setGrouping() call.



--
You received this message because you are subscribed to the Google Groups "SlickGrid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slickgrid+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Adam Gruszynski

unread,
Mar 21, 2013, 6:26:00 PM3/21/13
to slic...@googlegroups.com

That will solve this issue, note the group headers flipped?  Image attached.


On Thursday, March 21, 2013 5:02:45 PM UTC-5, Adam Gruszynski wrote:

Michael Leibman

unread,
Mar 21, 2013, 6:27:48 PM3/21/13
to slickgrid
I have no idea what you mean to say by that image.


--

Adam Gruszynski

unread,
Mar 21, 2013, 6:32:56 PM3/21/13
to slic...@googlegroups.com
I've grouped the rows by the type of record...In-Processing and Posting.  When I sort by amountand its ascending, In-Processing is first.  When its descending, Posting is first.  I don't want the groups to change order, just the rows within each group.  Looking at your grouping example, Duration 0 is always first when you sort by %Complete.  Did I explain that better?

Michael Leibman

unread,
Mar 21, 2013, 6:36:13 PM3/21/13
to slickgrid
I understand the question, but I believe I already answered it.

Adam Gruszynski

unread,
Mar 21, 2013, 7:49:07 PM3/21/13
to slic...@googlegroups.com
I have implemented the comparator in the set grouping, however when I sort the columns by clicking the header, it sorts the data AND reordersthe groups. I'm sorry if I'm not understanding but I thought this was the place to go for assistance.

Michael Leibman

unread,
Mar 21, 2013, 8:24:03 PM3/21/13
to slickgrid
This is the right place.

If you have specified the correct comparer in the grouping call and it's not doing the right thing, please post a repro example on jsfiddle.net and I can take a look.


On Thu, Mar 21, 2013 at 4:49 PM, Adam Gruszynski <agrus...@gmail.com> wrote:
I have implemented the comparator in the set grouping, however when I sort the columns by clicking the header, it sorts the data AND reordersthe groups.  I'm sorry if I'm not understanding but I thought this was the place to go for assistance.

Adam Gruszynski

unread,
Mar 21, 2013, 10:33:40 PM3/21/13
to slic...@googlegroups.com
I spent a little more time with it and found that my comparer was incorrect.  Thanks for persisting.  BTW, I really like this grid.  I have it binding with knockout in a .net mvc4 application with async data refresh.  Thanks for making this available!

Regards,
Adam

Adam Gruszynski

unread,
Mar 21, 2013, 10:36:13 PM3/21/13
to slic...@googlegroups.com
Oh, and I've found very little that isn't compatible with jquery 1.9.1 and ui 1.10.1, just the $.browser.msie && $.browser.version code since that's been removed from 1.9+
.

Michael Leibman

unread,
Mar 21, 2013, 10:40:27 PM3/21/13
to slickgrid
You're welcome.
FYI, all the $.browser stuff has been removed from SlickGrid.  It's still present in a couple of examples, but that's irrelevant.

Steve Fazekas

unread,
Mar 22, 2013, 8:47:13 AM3/22/13
to slic...@googlegroups.com
Adam,

Are you doing the asynchronous data refresh with each cell change or are you compiling updates in a group using a save button?   Just curious.  I'm using the latter but may move to a cell by cell save event in certain cases.  I'm using .Net MVC 4 with jQuery.  All the data is sent thru JSON post. 

I've used the row reordering example and removed sorting.  That works really well in a case where I have to save an order of columns for a view I have set up. 

My grouping example I took out all editing and sorting features.  I have not tried to extend that beyond its current features.  

I'm working on screen shots and will post examples.  The app is nearly fully baked at this point and I'm happy with the features Michael has put together for us to use.  

Steve Fazekas


Sent from my iPhone

Adam Gruszynski

unread,
Apr 4, 2013, 10:58:31 AM4/4/13
to slic...@googlegroups.com
Hi Steve,

Thanks for the follow-up.  I'm actually not using the cell edit feature.  My challenge ended up being my comparer not being setup correctly.  I've also implemented reordering in another grid and appears to work well enough.  In that particular case, I don't have sorting since the reorder event actually updates the db and the item sequence(I want that to be an explicit event and not just triggered by a sort).

So at this point, in both grids, everything is working.  I'm using MVC4/jquery and knockout as my base tool set.  Knockout makes the asynchronous data loading a snap.

Regards,
Adam
Reply all
Reply to author
Forward
0 new messages