472,803 Members | 1,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,803 software developers and data experts.

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
4 2727
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tim | last post by:
I've been working on this for over a week now, and just can't get this figured out. Hoping one of you gurus can help me out here. I have an xml data island that I'm representing on an htm page as...
4
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
2
by: jab3 | last post by:
Hello - I'm trying to implement a table that will allow the user to sort on each column, like many applicaitons that have tabular data (e-mail, song list, etc). It invovles grabbing the table,...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
6
by: bcochofel | last post by:
I'm using xsl to list an xml file that contains something like: sites, tag and weight. I'm listing this in a table with the following titles: | URL | TAG | WEIGHT (each title his a link) What...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
1
by: dorandoran | last post by:
The sort on the childgrid is not working; nothing happens when I click on the each column header for sort. (I followed Satay's sample: http://www.codeproject.com/KB/aspnet/EditNestedGridView.aspx)...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.