467,878 Members | 1,289 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,878 developers. It's quick & easy.

Sorting a HTML table with Javascript

I'm trying to implement a way of allowing a user to sort a HTML table
via Javascript on the client. I've seen lots of samples where single
column sorting (asc or desc) is shown, but I'd like nested sorting i.e.
sort by col1 asc, then by col2 desc etc. Can anyone help ?
Jul 23 '05 #1
  • viewed: 2460
Share:
4 Replies
"Gareth Gale" <ga*********@hp.com> wrote in message
news:cj**********@news.unix-apps.rit.sc2.udc.hpl.hp.com...
I'm trying to implement a way of allowing a user to sort a HTML table
via Javascript on the client. I've seen lots of samples where single
column sorting (asc or desc) is shown, but I'd like nested sorting i.e.
sort by col1 asc, then by col2 desc etc. Can anyone help ?


Next time first try a Google search on:

Sorting a HTML table with Javascript
Jul 23 '05 #2
As per my initial message, I have done this. The post refers to the fact
that there seems to be plenty of examples where single column sorting is
permitted, but not nested sorting. I'd really like examples of the latter.

McKirahan wrote:
"Gareth Gale" <ga*********@hp.com> wrote in message
news:cj**********@news.unix-apps.rit.sc2.udc.hpl.hp.com...
I'm trying to implement a way of allowing a user to sort a HTML table
via Javascript on the client. I've seen lots of samples where single
column sorting (asc or desc) is shown, but I'd like nested sorting i.e.
sort by col1 asc, then by col2 desc etc. Can anyone help ?

Next time first try a Google search on:

Sorting a HTML table with Javascript

Jul 23 '05 #3
On Tue, 28 Sep 2004 09:35:35 +0100, Gareth Gale <ga*********@hp.com>
wrote:
As per my initial message, I have done this. The post refers to the fact
that there seems to be plenty of examples where single column sorting is
permitted, but not nested sorting. I'd really like examples of the latter.

McKirahan wrote:
"Gareth Gale" <ga*********@hp.com> wrote in message
news:cj**********@news.unix-apps.rit.sc2.udc.hpl.hp.com...
I'm trying to implement a way of allowing a user to sort a HTML table
via Javascript on the client. I've seen lots of samples where single
column sorting (asc or desc) is shown, but I'd like nested sorting i.e.
sort by col1 asc, then by col2 desc etc. Can anyone help ?

Next time first try a Google search on:

Sorting a HTML table with Javascript


In theory, can't you put the groups in TBODYs, sort by TBODY and then
by TD within the TBODY?

But how many different ways is the table to be sorted?

Apart from using TBODY method, is it possible to add attributes to a
TD for each particular sort group and then sort by these user created
attributes?

Jul 23 '05 #4
"Gareth Gale" <ga*********@hp.com> wrote in message
news:cj**********@news.unix-apps.rit.sc2.udc.hpl.hp.com...
As per my initial message, I have done this. The post refers to the fact
that there seems to be plenty of examples where single column sorting is
permitted, but not nested sorting. I'd really like examples of the latter.

McKirahan wrote:
"Gareth Gale" <ga*********@hp.com> wrote in message
news:cj**********@news.unix-apps.rit.sc2.udc.hpl.hp.com...
I'm trying to implement a way of allowing a user to sort a HTML table
via Javascript on the client. I've seen lots of samples where single
column sorting (asc or desc) is shown, but I'd like nested sorting i.e.
sort by col1 asc, then by col2 desc etc. Can anyone help ?

Next time first try a Google search on:

Sorting a HTML table with Javascript


Sorry, I did not read your post as well as I should have.

You should be able to adopt single column sorting logic for multiple
columns.

The trick is to allow the user to identify what columns sort in what
sequence and how (asc or desc). Are you looking for a generic solution or
do you have a specific table in miond? If the latter, what are the columns
and what sort options do you want?
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by mike | last post: by
2 posts views Thread by jab3 | last post: by
1 post views Thread by jmdolinger | last post: by
6 posts views Thread by bcochofel | last post: by
7 posts views Thread by Kamal | last post: by
1 post views Thread by dorandoran | last post: by
5 posts views Thread by jrod11 | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.