Sorting a HTML table with Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gareth Gale

    #1

    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 ?
  • McKirahan

    #2
    Re: Sorting a HTML table with Javascript

    "Gareth Gale" <gareth.gale@hp .com> wrote in message
    news:cj9e2i$vef $1@news.unix-apps.rit.sc2.ud c.hpl.hp.com...[color=blue]
    > 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 ?[/color]

    Next time first try a Google search on:

    Sorting a HTML table with Javascript


    Comment

    • Gareth Gale

      #3
      Re: Sorting a HTML table with Javascript

      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:[color=blue]
      > "Gareth Gale" <gareth.gale@hp .com> wrote in message
      > news:cj9e2i$vef $1@news.unix-apps.rit.sc2.ud c.hpl.hp.com...
      >[color=green]
      >>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 ?[/color]
      >
      >
      > Next time first try a Google search on:
      >
      > Sorting a HTML table with Javascript
      >
      >[/color]

      Comment

      • mark4asp

        #4
        Re: Sorting a HTML table with Javascript

        On Tue, 28 Sep 2004 09:35:35 +0100, Gareth Gale <gareth.gale@hp .com>
        wrote:
        [color=blue]
        >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:[color=green]
        >> "Gareth Gale" <gareth.gale@hp .com> wrote in message
        >> news:cj9e2i$vef $1@news.unix-apps.rit.sc2.ud c.hpl.hp.com...
        >>[color=darkred]
        >>>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 ?[/color]
        >>
        >>
        >> Next time first try a Google search on:
        >>
        >> Sorting a HTML table with Javascript[/color][/color]

        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?

        Comment

        • McKirahan

          #5
          Re: Sorting a HTML table with Javascript

          "Gareth Gale" <gareth.gale@hp .com> wrote in message
          news:cjb7qn$mrm $1@news.unix-apps.rit.sc2.ud c.hpl.hp.com...[color=blue]
          > 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:[color=green]
          > > "Gareth Gale" <gareth.gale@hp .com> wrote in message
          > > news:cj9e2i$vef $1@news.unix-apps.rit.sc2.ud c.hpl.hp.com...
          > >[color=darkred]
          > >>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 ?[/color]
          > >
          > >
          > > Next time first try a Google search on:
          > >
          > > Sorting a HTML table with Javascript[/color][/color]

          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?


          Comment

          Working...