Order by [row]
So after a few hours of research I have gotten no where with this.
What I want to do is if I got a list with with 4 headlines called id, name, category, subcategory. If i press on ID I want the list to order by id ASC, press again DESC. If I press name same thing but with name.
Thank you in advance!
Thanks for the qucik answer.
I don't seem to find anything about it when researching. Don't know where to begin .. :/
Your information have gotten me much closer, thanks! But do you recommend using the jquery plugin called DataTable or build your own?
My own JS library is designed to handle things like this out of the box by attaching a 'uSort' method to TBODY elements.
It's currently in early beta and there's a major compatibility bug with legacy IE (that came about from my taking bad advice from someone) that I need to fix, but as you can see on that page implementing it is pretty simple compared to other methods. You could easily eventAdd a handler to your THEAD's TH (assuming you have proper document structure) to say to sort by that field and reverse the order if already sorted by that one.
I'm fixing that legacy IE bug right now, but when I'm done I'll toss together an example of that in action for you. It's a lot leaner a solution than jQuery (to the tune of 1/8th the size once compressed) and assuming your table is well formed should be pretty speedy too.
... and here it is; and thanks for the inspiration; doing this squashed a whole slew of bugs in my library.
as with all my examples the directory:
is unlocked for easy access to the gooey bits and pieces.
Works all the way back to IE 5.5, other than the generated content I used in the CSS for the arrows; you could just as easily use background-images or even add span to the markup for sliding doors on those. Just wanted to keep it simple for this demo.
I'll write up an explanation of it tonight hopefully, on the way out the door right now.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread