Hi there,
Is it at all possible to sort the contents of a table (ordinary html
<table><tr><td> ...</td></tr></table>) using javascript? What I want is to be
able to select, for example by klicking a button or checking a radio button,
whether the table shall be sorted by column 1 och 2. Even if the table has
three or more columns I'm only interested in sorting (increasingly) by first
or second.
I would be nice if I did not have to change my table contents (I already
have it, 87 rows, 9 columns, with lots of links and stuff) into say an
array, but if that is the only way then maybe I will have to accept that.
So, any ideas?
Many thanks in advance,
MM 2 2652
MM wrote on 03 Dec 2003: Hi there,
Is it at all possible to sort the contents of a table (ordinary html <table><tr><td> ...</td></tr></table>) using javascript? What I want is to be able to select, for example by klicking a button or checking a radio button, whether the table shall be sorted by column 1 och 2. Even if the table has three or more columns I'm only interested in sorting (increasingly) by first or second.
I would be nice if I did not have to change my table contents (I already have it, 87 rows, 9 columns, with lots of links and stuff) into say an array, but if that is the only way then maybe I will have to accept that.
I think the most efficient way would be to read the table into a
multidimensiona l array, sort that, then write it back out using DOM
methods.
You could do it more or less in-place, but you'd have to do the sort
manually, as apposed to using the Array.sort() method.
Of course, this won't work in older browsers.
Mike
--
Michael Winter M.******@blueyo nder.co.uk.invalid (remove ".invalid" to reply)
Just have a look here. http://webfx.eae.net/dhtml/sortabletable/demos.html
Helped me a lot
Cheers
Fermin DCG
MM wrote: Hi there,
Is it at all possible to sort the contents of a table (ordinary html <table><tr><td> ...</td></tr></table>) using javascript? What I want is to be able to select, for example by klicking a button or checking a radio button, whether the table shall be sorted by column 1 och 2. Even if the table has three or more columns I'm only interested in sorting (increasingly) by first or second.
I would be nice if I did not have to change my table contents (I already have it, 87 rows, 9 columns, with lots of links and stuff) into say an array, but if that is the only way then maybe I will have to accept that.
So, any ideas?
Many thanks in advance,
MM This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: p0wer |
last post by:
Let's suppose I have this sample document:
<root>
<entry id="1"
<date>2003-08-03</date>
<param_1>5</param_1>
<param_2>10</param_2>
</entry>
<entry id="2">
...
|
by: Matt Kruse |
last post by:
I'm looking for the best JS/CSS solution to add functionality to tables.
The only browser which needs to be supported is IE5.5+, but no activeX can
be used.
to be able to do:
- Fixed header row
- Data sorting (preferrably intelligently determining data type based on
content)
- If possible, locking the first column from scrolling
|
by: Gareth Gale |
last post by:
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 ?
|
by: Mike |
last post by:
Hello,
I have a few rather urgent questions that I hope someone can help with (I
need to figure this out prior to a meeting tomorrow.) First, a bit of
background: The company I work for is developing a web-based application,
one part of which involves allowing the user the ability to page through
transaction "history" information.
The _summary_ history table will have the following fields: ServiceName,
Date, User-Ref1, User-Ref2,...
|
by: John Smith |
last post by:
Hello all:
New problem. I am currently storing some mostly numeric values as ids
in a db but with the possiblity that there are revisions to each. For
instance say we have a record such as 100, a revision may need to be
added such as 100a. As a result this column in the db must be set to a
string data type. However, when I do so the sort order gets whacked.
We have some records in the hundreds and they show up after those in the...
| |
by: Simon Gregory |
last post by:
I am currently attempting to figure out how the new databinding
stucture works in ASP.NET 2.0 after working with v1.0 & v1.1 for
several years.
It seems that if you wish to do set up databinding at Design Time, you
are restricted to using one of the 5 xxxDataSource controls.
The data in our websites are usually obtained via a set of webservices
and are contained in a set of strongly typed relational DataSets.
|
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 expandable row, the
hidden row is made visible with css. The problem is when i sort the
rows, the hidden rows get sorted as well which i don't want and want
to be moved (while sorting) relative to their parent rows. The
following is my complete html code...
|
by: Dan Grigore |
last post by:
I am creating a table cell by cell (create the table, add columns, create
row, add cells to the row) in which I want to add the capability for users
to sort ASC and DESC by column header.
Can anyone give me an idea or an example of how can I do this in code ?
Thank you.
Dan
|
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 there are, it crashes.
There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)?
Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html
Here is some jquery js that I think...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |