Web Development with jQuery®

(Elliott) #1

Sorting a Table (^) ❘ 439
Figure 19-2 shows how to sort by multiple columns. To do this, sort the fi rst column by clicking the
column header; then hold down the Shift key to click a second column header.


FIGURE 19-2


This example is primarily about setting up the proper HTML and then styling it with CSS. The


$.tablesorter() plugin’s default functionality provides the rest as soon as it is applied.


You can customize several aspects of $.tablesorter() using the options documented in Appendix T.


For example, you can change which keyboard key you have to press to select a second column for


sorting using the option sortMultiSortKey. The default value is 'shiftKey'; to make it the Option


(Mac) or Alt (Windows) key, you would change the value to 'altKey'.


http://www.it-ebooks.info

Free download pdf