I think a table should be sortable. As an exercise I'll be designing and implementing a script to interactively sort a html table.

Design

Sorting should happen by column, and be accumulative, e.g. sort by vendor, then price, then color. For simplicity the sort order will be set by the column's text direction order.

Vendor Price Color
Al's 12.00 Orange
Ed's 15.00 Yellow
Ed's 18.00 Orange
Luke's 18.00 Blue
Luke's 20.00 Blue
Luke's 20.00 Red
Price Vendor Color
12.00 Al's Orange
15.00 Ed's Yellow
18.00 Ed's Orange
18.00 Luke's Blue
20.00 Luke's Blue
20.00 Luke's Red
Color Price Vendor
Blue 18.00 Luke's
Blue 20.00 Luke's
Orange 12.00 Al's
Orange 18.00 Ed's
Red 20.00 Luke's
Yellow 15.00 Ed's

The columns are moved via drag and drop of the column header. The table will update as the pointer crosses a column boundry.

Implementation

Standards will be followed to a fault. These will include xhtml, dom, and ecmascript.

Binding the Script to the Table

Table's will gain sorting functionality by being of class "sortable". Let's see if we can make the script associate.

#01 Test