Hi, Thanks for Your reply. But I believe there's a bug in the class then. Take a look a modified example of Yours:
http://mootools.net/shell/463Mn/9/ It's sorted first by column 1 (secondary sort) and then by column 0. Column 0 gets sorted fine, but as You can see, in column 1 the results are: 22, 66, 11. Which isn't sorted. Am I correct that this is a bug, or am I doing something wrong? On May 5, 6:42 pm, Aaron Newton <[email protected]> wrote: > HtmlTable's sort functionality allows for secondary sorting, but it doesn't > do this by default. If you look at the docs, the sort method takes a second > argument that allows you to "prepare" a column to be a secondary sort. > Here's a shell illustrating this: > > http://mootools.net/shell/463Mn/1/ > > Note that I sort on column 3, but the secondary sort is on the first > column. > > The click handlers for the headers don't do this. You'll need to write some > logic of your own to allow your users to enable a secondary sort. If it were > me, I'd extend the class and overwrite the headClick method: > > http://mootools.net/shell/463Mn/2/ > > enjoy. > > > > On Tue, May 4, 2010 at 5:05 AM, Axel <[email protected]> wrote: > > Hello Mootools users too, > > > I have been wondering more less the same question... > > > I'm running around and looking for the right solution to do this : I > > have an HtmlTable sortable by many columns. I want to set a column as > > a fixed second sort option so some elements stay linked together. > > > Example :http://mootools.net/shell/463Mn/ > > - If I want to sort by Text, I'd like that first sort takes index 1 > > and 0 as a second sort element > > - If I want to sort by Country, I'd like that first sort takes index 2 > > and 0 as a second sort element > > > The idea I first had was to use the option onSort to resort the > > current Table (Table.sort()) and pass the index+reverse+prepare to do > > this. But I'm wondering on the "good" idea. Would that be a good way ? > > > This is more less the same question as Maciej as I can't find some > > examples to use onSort and prepare ... > > > Many thanks for your help all, > > > Axel. > > > On 3 mai, 20:38, Maciej Trebacz <[email protected]> wrote: > > > Hello Mootools users, > > > > I have a question about HtmlTable.Sort. In documentation of sort() > > function > > > it states that you can have secondary sorting using this class. However I > > > couldn't guess how one can use this. Can anyone show me an example or > > point > > > me in the right direction? I have a table with names and some functions, > > and > > > I want to make it work when user sorts against "function", and two items > > has > > > same "function" it should then sort it by "name". > > > > -- > > > Best regards, > > > Maciej "mav" Trębacz
