This contains two simple tables with SortableTable objects attached to
them. For the second table the thead
has been hidden using CSS.
This demo generates a large table during load. A string is generated using
a StringBuilder
and then written to the page using
document.write
. When generating such long strings as this the gain
of using a string builder is huge. The demo also uses the asyncSort
method to be able to write out a status messsage while the sorting is being done.
In this demo the rows have alternating colors. Since the sorting reorders the
rows we'll have to change the colors after the actual sorting. This is done in
the onsort
handler.
This demo table has a column containing inputs. In this case we define our own
custom getRowValue
to find the value of the input.
This demo would have been much simpler if IE did not have a bug when it comes to DOM and input elements. In IE the value of the input is lost when doing DOM manipulations and therefore we store the input value before the sort and restore it afterwards.
This demo shows how to add a custom sort type using a external JavaScript files. There is no need to create a sub class or override any methods to achieve this any more. Just one line of code to add the new sort type.