Prev | Current Page 749 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

js??? > < /script >
< /body >
< /html >
402
Part II: Server Side, JavaScript, and Flash: Oh My!
The interesting thing in the table is that the second column is numeric and sorting must be made in this
disguise; the third column is trickier, it contains a text description, a date portion (month - day), and the
anniversary year in parentheses. The order on that column must follow the month - day sequence because
that is probably what the user may expect by the heading ??? National Holiday. ???
To address the second column, the setParser() function is invoked passing a function that strips off
the thousand separators and parses the resulting string to an Int value. For the third column, the string
is matched against a regular expression that extracts just the month and day values; the month is
multiplied by one hundred and added to the day to obtain an integer that can be easily compared.
To enhance a table, a reference to it must be passed as argument to the method apply() .
import js.Dom;
class Main
{
public static function main()
{
var sorter = new TableSorter();
sorter.


Pages:
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761