Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Multi column sort support with an example #276

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Contributor

mrigi commented Feb 4, 2012

multiSort option been added to the grid.
When set to false (default) should work as before in compatibility mode.
When set to true onSort event will send array of objects [{column,sortAsc},...].
dataView is not touched.

The example is in examples folder with the name of example-multi-column-sort.

Owner

mleibman commented Feb 6, 2012

Thanks. I've merged in your code with some modifications.

@mleibman mleibman closed this Feb 6, 2012

Contributor

ghiscoding commented Feb 6, 2012

That would be nice if we could see the example sample on the "Example" page from the Wiki...
Seems a nice feature to have :)

Owner

mleibman commented Feb 6, 2012

already there

On Mon, Feb 6, 2012 at 5:50 AM, ghiscoding <
reply@reply.github.com

wrote:

That would be nice if we could see the example sample on the "Example"
page from the Wiki...
Seems a nice feature to have :)


Reply to this email directly or view it on GitHub:
#276 (comment)

Contributor

ghiscoding commented Feb 7, 2012

Hello, I know this code is suppose to be closed but I see 2 minor issues with this implementation. So I just want to mention it and see if it's workable. Apart from that, great work guys.

1- Sorting on a 2+ columns won't give any indication that first couple columns are still under a sort. The up/down arrow only shows up on the current sort though previous are still sorted.

2- I don't see any ways of removing multi-column sorting apart from refreshing the page... Would it be possible to do a 3 clicks solution? I mean 1st click to sort ascending, 2nd click to sort descending and 3rd click to remove any sorting.

For sure I'll use this code quite soon, this is a nice feature to have. Great work.

Owner

mleibman commented Feb 7, 2012

Umm... are we looking at the same thing? Sorting multiple columns (with shift or ctrl-click) applies the styling to all columns being sorted on and clicking on any column reverts to single-column sort.

Contributor

ghiscoding commented Feb 7, 2012

Oh my bad, I just didn't know how it was working.... This is exactly working like you said on the Shift+Ctrl. That's awesome. The Ctrl+Click doesn't do anything else though.
Would it be possible to change the text on the right so that we know how to use it. I mean I know now but for others...

Out of topic:
I'll contribute more codes as well tomorrow probably, after cleaning the code, I've done some customs Editor, hopefully you're interested.
Something that looks like this:
editor:ConditionCellEditor, editorOptions:{minLength:1, maxLength:3, required:true}
editor: SelectCellEditor, editorOptions:{options:"Administrator,Supervisor,Manager", defaultText:"Supervisor"}

Owner

mleibman commented Feb 7, 2012

Ctrl-click should've worked, but I'll double-check when I get to my computer at work.
SelectCellEditor might be nice, not sure about the other one. Mostly, they are just samples as the user will probably need to implement their own.

Contributor

mrigi commented Feb 7, 2012

Ctrl-click was working in the original version then you replaced it with the meta key for some reason.

domenic commented Jan 9, 2013

Can we get an option to enable this without modifier keys? :-/

Owner

mleibman commented Jan 9, 2013

This seems to work perfectly for me. As for the Ctrl vs Meta, jQuery used to normalize the Win Ctrl and Mac Option to Meta, but stopped doing this, so I reverted back to Ctrl.

@domenic It wouldn't make much sense without the modifier keys. You would never be able to sort anything :)

domenic commented Jan 9, 2013

@mleibman what do you mean? you'd always sort primarily by the last column you clicked, which is the most important part; preserving the sort order of previously-clicked columns is the bonus feature that IMO is the essence of multi-column sort.

Owner

mleibman commented Jan 9, 2013

@domenic in multi-sort scenario, you sort primarily by the FIRST column you clicked. what you're describing is just called a basic stable sort.

domenic commented Jan 9, 2013

Oh, dear. It seems I've entirely misunderstood the purpose of the multi-column sort then. Carry on!

Owner

mleibman commented Jan 9, 2013

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment