Skip to content
Browse files

columns widget

  • Loading branch information...
1 parent 1153c05 commit db0863f433110ee7b72c2b3595a1f0c9035bfb4a @Mottie committed Sep 11, 2011
View
10 README.markdown
@@ -28,6 +28,16 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
+#### Version 2.0.17 (2011-09-11)
+
+* Added a jquery.tablesorter.widget.js file:
+ * It contains the "uitheme" widget, to add any jQuery UI theme, and the new "columns" widget, to style columns.
+ * The blue and green themes have been updated with the added styles from the columns widget.
+ * Added a Columns Widget demo and instructions.
+* Added a `widgetColumns` option which defines the css classes added by the columns widget.
+* Added notes to the pager plugin demo page to better specify when a change was added.
+* The green theme header images have been modified to better work with variable width tables.
+
#### Version 2.0.16 (2011-09-08)
* Added notes to demo pages to indicate if the original (version 2.0.5, at [tablesorter.com](http://tablesorter.com/docs/)) does have that option or method.
View
11 changelog.txt
@@ -1,5 +1,16 @@
TableSorter Change Log
+Version 2.0.17 (2011-09-11)
+============================
+
+* Added a jquery.tablesorter.widget.js file:
+ * It contains the "uitheme" widget, to add any jQuery UI theme, and the new "columns" widget, to style columns.
+ * The blue and green themes have been updated with the added styles from the columns widget.
+ * Added a Columns Widget demo and instructions.
+* Added a `widgetColumns` option which defines the css classes added by the columns widget.
+* Added notes to the pager plugin demo page to better specify when a change was added.
+* The green theme header images have been modified to better work with variable width tables.
+
Version 2.0.16 (2011-09-08)
============================
View
BIN css/blue/blue.zip
Binary file not shown.
View
45 css/blue/style.css
@@ -1,15 +1,15 @@
/* Blue Theme */
table.tablesorter {
font-family: arial;
- background-color: #CDCDCD;
+ background-color: #cdcdcd;
margin: 10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
- background-color: #e6EEEE;
- border: 1px solid #FFF;
+ background-color: #e6eeee;
+ border: 1px solid #fff;
border-collapse: collapse;
font-size: 8pt;
padding: 4px;
@@ -21,14 +21,11 @@ table.tablesorter thead tr .header {
cursor: pointer;
}
table.tablesorter tbody td {
- color: #3D3D3D;
+ color: #3d3d3d;
padding: 4px;
- background-color: #FFF;
+ background-color: #fff;
vertical-align: top;
}
-table.tablesorter tbody tr.odd td {
- background-color: #F0F0F6;
-}
table.tablesorter thead tr .headerSortUp {
background-image: url(black-asc.gif);
}
@@ -37,4 +34,34 @@ table.tablesorter thead tr .headerSortDown {
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #8dbdd8;
-}
+}
+
+/* Zebra Widget - row alternating colors */
+table.tablesorter tbody tr.odd td {
+ background-color: #f0f0ff;
+}
+table.tablesorter tbody tr.even td {
+ background-color: #fff;
+}
+
+/* Column Widget - column sort colors */
+table.tablesorter tbody td.primary, table.tablesorter tbody tr.odd td.primary {
+ background-color: #c0c0ff;
+}
+table.tablesorter tbody tr.even td.primary {
+ background-color: #e8e8ff;
+}
+
+table.tablesorter tbody td.secondary, table.tablesorter tbody tr.odd td.secondary {
+ background-color: #d6d6ff;
+}
+table.tablesorter tbody tr.even td.secondary {
+ background-color: #e8e8ff;
+}
+
+table.tablesorter tbody td.tertiary, table.tablesorter tbody tr.odd td.tertiary {
+ background-color: #e5e5ff;
+}
+table.tablesorter tbody tr.even td.tertiary {
+ background-color: #f8f8ff;
+}
View
BIN css/green/asc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN css/green/bg.png
Deleted file not rendered
View
BIN css/green/bkgd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN css/green/desc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN css/green/green.zip
Binary file not shown.
View
BIN css/green/none.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
82 css/green/style.css
@@ -1,39 +1,69 @@
+/* green theme */
table.tablesorter {
+ font-family: arial;
+ background-color: #cdcdcd;
+ margin: 10px 0pt 15px;
font-size: 12px;
- background-color: #4D4D4D;
- width: 1024px;
- border: 1px solid #000;
-}
-table.tablesorter th {
+ width: 100%;
text-align: left;
+}
+table.tablesorter thead tr th, table.tablesorter tfoot tr th {
+ background-color: #e6eeee;
+ border-collapse: collapse;
+ font-size: 12px;
padding: 5px;
- background-color: #6E6E6E;
}
table.tablesorter td {
- color: #FFF;
+ color: #3d3d3d;
padding: 5px;
}
-table.tablesorter .even {
- background-color: #3D3D3D;
-}
-table.tablesorter .odd {
- background-color: #6E6E6E;
+table.tablesorter thead {
+ background: url(bkgd.png) center center repeat-x;
}
table.tablesorter .header {
- background-image: url(bg.png);
- background-repeat: no-repeat;
- border-left: 1px solid #FFF;
- border-right: 1px solid #000;
- border-top: 1px solid #FFF;
- padding-left: 30px;
- padding-top: 8px;
+ background: transparent;
+ padding: 9px;
height: auto;
+ cursor: pointer;
+}
+table.tablesorter .header span {
+ background: url(none.png) no-repeat;
+ padding: 2px 0 2px 25px;
+}
+table.tablesorter .headerSortUp span {
+ background: url(asc.png) no-repeat;
+}
+table.tablesorter .headerSortDown span {
+ background: url(desc.png) no-repeat;
+}
+
+/* Zebra Widget - row alternating colors */
+table.tablesorter tr.odd td {
+ background-color: #f0f6f0;
+}
+table.tablesorter tr.even td {
+ background-color: #fff;
+}
+
+/* Column Widget - column sort colors */
+table.tablesorter tbody td.primary, table.tablesorter tbody tr.odd td.primary {
+ background-color: #c0ffc0;
+}
+table.tablesorter tbody tr.even td.primary {
+ background-color: #e8ffe8;
+}
+
+table.tablesorter tbody td.secondary, table.tablesorter tbody tr.odd td.secondary {
+ background-color: #d6ffd6;
+}
+table.tablesorter tbody tr.even td.secondary {
+ background-color: #e8ffe8;
+}
+
+table.tablesorter tbody td.tertiary, table.tablesorter tbody tr.odd td.tertiary {
+ background-color: #eaffea;
}
-table.tablesorter .headerSortUp {
- background-image: url(asc.png);
- background-repeat: no-repeat;
+table.tablesorter tbody tr.even td.tertiary {
+ background-color: #f8fff8;
}
-table.tablesorter .headerSortDown {
- background-image: url(desc.png);
- background-repeat: no-repeat;
-}
+
View
14 docs/css/jq.css
@@ -2,8 +2,8 @@ body,div,h1{font-family:'trebuchet ms', verdana, arial;margin:0;padding:0;}
body{background-color:#fff;color:#333;margin:0;padding:0;}
h1{font-size:large;font-weight:400;margin:0;}
h2{color:#333;font-size:small;font-weight:400;margin:0;}
-.demo{width:600px;margin:0 auto;}
-.demo h1,.demo h1 a{font-size:120%;text-align:center;text-decoration:none;}
+.demo{width:600px;margin:20px auto;}
+.demo h1,.demo h1 a{font-size:120%;text-align:center;text-decoration:none;color:#000;}
.demo p{text-align:center;}
.demo table.tablesorter{font-size:14px;}
table.info{border:#000 1px solid;border-collapse:collapse;margin:10px 0 0 10px;}
@@ -17,20 +17,20 @@ pre,#display,code.hilight{background-color:#eee;color:#333;font-size:small;list-
a code.hilight {text-decoration:underline;}
pre.normal{background-color:transparent;border:none;border-left-width:0;overflow-x:auto;}
#logo{background:url(images/jq.png);display:block;float:right;height:31px;margin-right:10px;margin-top:10px;width:110px;}
-#main{margin:0 20px 20px;padding:0 15px 15px 0;}
+#main{margin:0 20px 20px;padding:0 15px 15px 0;clear:both;}
#content{padding:20px;}
#busy{background-color:#e95555;border:1px ridge #ccc;color:#eee;display:none;padding:3px;position:absolute;right:7px;top:7px;}
#demo strong{color:#a00;}
hr{height:1px;}
code{font-size:108%;font-style:normal;padding:0;}
ul{color:#333;list-style:square;}
#banner{margin:20px 20px 5px 20px;padding:0;text-align:left;}
-#banner *{color:#232121;font-family:Georgia, Palatino, Times New Roman;font-size:30px;font-style:normal;font-weight:400;margin:0;padding:0;}
+#banner *,.demo h1,.demo h1 em{color:#232121;font-family:Georgia, Palatino, Times New Roman;font-size:30px;font-style:normal;font-weight:400;margin:0;padding:0;}
#banner h1{display:block;float:left;}
-#banner h1 em{color:#6cf;}
+#banner h1 em,.demo h1 em{color:#6cf;}
#banner h2{float:right;font-size:26px;margin:10px 10px -10px -10px;}
-#banner h3{clear:both;display:block;font-size:12px;margin-top:-20px;}
-#banner a{border-top:1px solid #888;display:block;font-size:14px;margin:5px 0 0;padding:10px 0 0;text-align:right;width:auto;}
+#banner h3{clear:both;display:block;font-size:12px;margin-top:-20px;border-bottom:1px solid #888;}
+#banner a{display:block;font-size:14px;margin:5px 0 0;padding:10px 0 0;float:right;}
a.external{background-image:url(../img/external.png);background-position:center right;background-repeat:no-repeat;padding-right:12px;}
form{font-size:10pt;margin-bottom:20px;width:auto;}
form fieldset{padding:10px;text-align:left;width:140px;}
View
2 docs/example-apply-widget.html
@@ -119,7 +119,7 @@
<div class="next-up">
<hr />
- Next up: <a href="example-zebra.html">Basic: Applying the zebra stripe widget &rsaquo;&rsaquo;</a>
+ Next up: <a href="example-widget-zebra.html">Basic: Applying the zebra stripe widget &rsaquo;&rsaquo;</a>
</div>
</div>
View
10 docs/example-pager.html
@@ -92,7 +92,15 @@
<div id="main">
<p class="tip">
- <em>NOTE!</em> Updated pager functions and added output string formatting (e.g. "1 to 10 (1022)") to version 2.0.9 (it is not part of the original plugin).
+ <em>NOTE!</em> The following are not part of the original plugin:
+ <ul>
+ <li>Added "pagerChange" and "pagerComplete" events in version 2.0.7.</li>
+ <li>Updated pager functions, removed "separator" option, and added output string formatting (e.g. "1 to 10 (50)") to version 2.0.9.</li>
+ <li>Added "cssDisabled" and "pagerArrows" options which controls the look of the pager and arrows when the pager is on the first or last page. Added in version 2.0.9.</li>
+ <li>Added a new "addRows" method to allow adding new rows while the pager is applied to a table. Using "update" would remove all non-visible rows. New in version 2.0.16.</li>
+ <li>New "destroy.pager" method will reveal the entire table, remove the pager functionality, and hide the actual pager. Added in version 2.0.16.</li>
+ <li>Reduced the number of rows in the demo from 1022 to 50, so you don't have to scroll forever (when the pager is destroyed) to see the code below the table (v2.0.16).</li>
+ </ul>
</p>
<h1>Triggered Events</h1>
View
137 docs/example-widget-columns.html
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>jQuery plugin: Tablesorter 2.0 - Columns Style Widget</title>
+
+ <!-- jQuery -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
+
+ <!-- Demo stuff -->
+ <link rel="stylesheet" href="css/jq.css">
+ <script src="js/chili/jquery.chili-2.2.js"></script>
+ <script src="js/chili/recipes.js"></script>
+ <script src="js/docs.js"></script>
+
+ <!-- Tablesorter: required -->
+ <link rel="stylesheet" href="../css/blue/style.css">
+ <script src="../js/jquery.tablesorter.js"></script>
+ <script src="../js/jquery.tablesorter.widgets.js"></script>
+
+ <!-- Tablesorter: optional -->
+ <!-- <script src="../addons/pager/jquery.tablesorter.pager.js"></script> -->
+
+<script id="js">$(function() {
+
+ // call the tablesorter plugin
+ $("table").tablesorter({
+ sortList : [[1,0],[2,0],[3,0]],
+ // initialize zebra striping and column styling of the table
+ widgets: ["zebra", "columns"],
+ // change the default column class names
+ // primary is the first column sorted, secondary is the second, etc
+ widgetColumns: { css: ["primary", "secondary", "tertiary" ] },
+ });
+
+});</script>
+</head>
+<body>
+<div id="banner">
+ <h1>table<em>sorter</em></h1>
+ <h2>Columns Style Widget</h2>
+ <h3>Flexible client-side table sorting</h3>
+ <a href="index.html">Back to documentation</a>
+</div>
+<div id="main">
+
+ <p class="tip">
+ <em>NOTE!</em> This widget can be applied to the original plugin.
+ </p>
+
+ <h1>Demo</h1>
+ <div id="demo"><table class="tablesorter">
+ <thead>
+ <tr>
+ <th>First Name</th>
+ <th>Last Name</th>
+ <th>Age</th>
+ <th>Total</th>
+ <th>Discount</th>
+ <th>Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Peter</td>
+ <td>Parker</td>
+ <td>28</td>
+ <td>$9.99</td>
+ <td>20%</td>
+ <td>Jul 6, 2006 8:14 AM</td>
+ </tr>
+ <tr>
+ <td>John</td>
+ <td>Hood</td>
+ <td>33</td>
+ <td>$19.99</td>
+ <td>25%</td>
+ <td>Dec 10, 2002 5:14 AM</td>
+ </tr>
+ <tr>
+ <td>Clark</td>
+ <td>Kent</td>
+ <td>18</td>
+ <td>$15.89</td>
+ <td>44%</td>
+ <td>Jan 12, 2003 11:14 AM</td>
+ </tr>
+ <tr>
+ <td>Bruce</td>
+ <td>Almighty</td>
+ <td>45</td>
+ <td>$153.19</td>
+ <td>44%</td>
+ <td>Jan 18, 2001 9:12 AM</td>
+ </tr>
+ <tr>
+ <td>Bruce</td>
+ <td>Evans</td>
+ <td>22</td>
+ <td>$13.19</td>
+ <td>11%</td>
+ <td>Jan 18, 2007 9:12 AM</td>
+ </tr>
+ </tbody>
+</table></div>
+
+ <h1>Page Header</h1>
+ <div>
+ <pre class="html">&lt;!-- blue theme stylesheet with additional css styles added in v2.0.17 --&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../css/blue/style.css&quot;&gt;
+&lt;!-- tablesorter plugin --&gt;
+&lt;script src=&quot;../js/jquery.tablesorter.js&quot;&gt;&lt;/script&gt;
+
+&lt;!-- tablesorter widget file - loaded after the plugin --&gt;
+&lt;script src=&quot;../js/jquery.tablesorter.widgets.js&quot;&gt;&lt;/script&gt;</pre>
+ </div>
+
+ <h1>Javascript</h1>
+ <div id="javascript">
+ <pre class="js"></pre>
+ </div>
+
+ <h1>HTML</h1>
+ <div id="html">
+ <pre class="html"></pre>
+ </div>
+
+<div class="next-up">
+ <hr />
+ Next up: <a href="example-widget-ui-theme.html">Basic: Applying a jQuery UI theme widget &rsaquo;&rsaquo;</a>
+</div>
+
+</div>
+
+</body>
+</html>
+
View
49 docs/example-ui-theme.html → docs/example-widget-ui-theme.html
@@ -20,46 +20,19 @@
<link rel="stylesheet" href="../css/ui/style.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/cupertino/jquery-ui.css">
<script src="../js/jquery.tablesorter.js"></script>
+ <script src="../js/jquery.tablesorter.widgets.js"></script>
<!-- Tablesorter: optional -->
- <script src="../addons/pager/jquery.tablesorter.pager.js"></script>
+ <!-- <script src="../addons/pager/jquery.tablesorter.pager.js"></script> -->
<script id="js">$(function() {
- // add ui theme widget
- $.tablesorter.addWidget({
- id: "uitheme",
- format: function(table) {
- var c = table.config,
- // ["up/down arrow (cssHeaders, unsorted)", "down arrow (cssDesc, descending)", "up arrow (cssAsc, ascending)" ]
- icons = c.uitheme || ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"],
- klass, rmv = icons.join(' ');
- if (!$(c.headerList[0]).is('.ui-theme')) {
- $(table).addClass('ui-widget ui-widget-content ui-corner-all');
- $.each(c.headerList, function(){
- $(this)
- // using "ui-theme" class in case the user adds their own ui-icon using onRenderHeader
- .addClass('ui-widget-header ui-corner-all ui-theme')
- .append('<span class="ui-theme"/>');
- });
- }
- $.each(c.headerList, function(i){
- if (c.headers[i] && c.headers[i].sorter === false) {
- // no sort arrows for disabled columns!
- $(this).find('span.ui-theme').removeClass(rmv + ' ui-icon');
- } else {
- //
- klass = ($(this).is('.' + c.cssAsc)) ? icons[1] : ($(this).is('.' + c.cssDesc)) ? icons[2] : $(this).is('.' + c.cssHeader) ? icons[0] : '';
- $(this).find('span.ui-theme').removeClass(rmv).addClass(klass + ' ui-icon');
- }
- });
- }
- });
-
// call the tablesorter plugin and apply the ui theme widget
$("table").tablesorter({
+ // widget code now contained in the jquery.tablesorter.widgets.js file
widgets : ['uitheme']
});
+
});</script>
<script>
@@ -143,6 +116,20 @@
</tbody>
</table></div>
+
+ <h1>Page Header</h1>
+ <div>
+ <pre class="html">&lt;!-- ui theme stylesheet - contents shown below --&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../css/ui/style.css&quot;&gt;
+&lt;!-- jQuery UI theme (cupertino example here) --&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/cupertino/jquery-ui.css&quot;&gt;
+
+&lt;!-- tablesorter plugin --&gt;
+&lt;script src=&quot;../js/jquery.tablesorter.js&quot;&gt;&lt;/script&gt;
+&lt;!-- tablesorter widget file - loaded after the plugin --&gt;
+&lt;script src=&quot;../js/jquery.tablesorter.widgets.js&quot;&gt;&lt;/script&gt;</pre>
+ </div>
+
<h1>Javascript</h1>
<div id="javascript">
<pre class="js"></pre>
View
2 docs/example-zebra.html → docs/example-widget-zebra.html
@@ -123,7 +123,7 @@
<div class="next-up">
<hr />
- Next up: <a href="example-ui-theme.html">Basic: Applying a jQuery UI theme widget &rsaquo;&rsaquo;</a>
+ Next up: <a href="example-widget-columns.html">Basic: Applying the columns widget &rsaquo;&rsaquo;</a>
</div>
</div>
View
42 docs/index.html
@@ -36,7 +36,7 @@
</div>
<p>
<strong>Author:</strong> <a class="external" href="http://lovepeacenukes.com">Christian Bach</a><br>
- <strong>Version:</strong> 2.0.16 (forked from <a href="http://tablesorter.com/docs/">version 2.0.5</a>, <a href="../changelog.txt">changelog</a>)<br>
+ <strong>Version:</strong> 2.0.17 (forked from <a href="http://tablesorter.com/docs/">version 2.0.5</a>, <a href="../changelog.txt">changelog</a>)<br>
<strong>Licence:</strong>
Dual licensed under <a class="external" href="http://www.opensource.org/licenses/mit-license.php">MIT</a>
or <a class="external" href="http://www.opensource.org/licenses/gpl-license.php">GPL</a> licenses.
@@ -298,8 +298,9 @@
<li><a href="example-options-headers-digits-strings.html">Dealing with text strings in numerical sorts</a> <span class="tip"><em>New! v2.0.10</em></span></li>
<li><a href="example-option-sort-order.html">Direction of initial sort</a></li>
<li><a href="example-apply-widget.html">Applying widgets</a></li>
- <li><a href="example-zebra.html">Applying the zebra stripe widget</a></li>
- <li><a href="example-ui-theme.html">Applying the jQuery UI theme widget</a> <span class="tip"><em>New! v2.0.9</em></span></li>
+ <li><a href="example-widget-zebra.html">Applying the zebra stripe widget</a></li>
+ <li><a href="example-widget-columns.html">Applying the columns widget</a> <span class="tip"><em>New! v2.0.17</em></span></li>
+ <li><a href="example-widget-ui-theme.html">Applying the jQuery UI theme widget</a> <span class="tip"><em>New! v2.0.9</em></span></li>
<li><a href="example-parsers-class-name.html">Disable or set the column parser using class names</a> <span class="tip"><em>New! v2.0.11</em></span></li>
<li><a href="example-options-headers.html">Disable sort using headers options</a></li>
<li><a href="example-options-headers-locked.html">Lock sort order using header options</a></li>
@@ -317,7 +318,7 @@
<li><a href="example-triggers.html">Triggers sortEnd and sortStart (Displaying sorting progress)</a></li>
<li><a href="example-empty-table.html">Initializing tablesorter on a empty table</a></li>
<li><a href="example-ajax.html">Appending table data with ajax</a></li>
- <li><a href="example-add-rows.html">Advanced: Adding a table row</a> <span class="tip"><em>New! v2.0.16</em></span></li>
+ <li><a href="example-add-rows.html">Adding a table row</a> <span class="tip"><em>New! v2.0.16</em></span></li>
<li><a href="example-update-cell.html">Update the table after cell content has changed</a></li>
<li><a href="example-option-text-extraction.html">Dealing with markup inside cells (textExtraction function)</a></li>
<li><a href="example-option-render-header.html">Modify how the header is rendered to allow for custom styling</a></li>
@@ -734,7 +735,7 @@
<td>
Initialize widgets using this option ( e.g. <code class="hilight">widgets : ['zebra']</code>, or custom widgets <code class="hilight">widgets: ['zebra', 'myCustomWidget'];</code>, see <a href="example-widgets.html">this demo</a> on how to write your own custom widget ).
</td>
- <td><a href="example-zebra.html">Example</a></td>
+ <td><a href="example-widget-zebra.html">Example</a></td>
</tr>
<tr id="widgetzebra">
@@ -752,7 +753,25 @@
});
});</pre></div>
</td>
- <td><a href="example-zebra.html">Example</a></td>
+ <td><a href="example-widget-zebra.html">Example</a></td>
+ </tr>
+
+ <tr id="widgetcolumns">
+ <td><a href="#" class="toggle2">widgetColumns</a></td>
+ <td>Object with Array</td>
+ <td>{css:[ "primary", "secondary", "tertiary" ]}</td>
+ <td>
+ When the column styling widget is initialized, it automatically applied the default class names of <code class="hilight">"primary"</code> for the primary sort, <code class="hilight">"secondary"</code> for the next sort, <code class="hilight">"tertiary"</code> for the next sort, and so on (add more as needed)... <span class="tip"><em>New!</em></span> in v2.0.17.
+ <div class="collapsible">
+ Use the <a href="#widgetcolumns"><code class="hilight">"widgetColumns"</code></a> option to change the css class name as follows:
+ <pre class="js">$(function(){
+ $("table").tablesorter({
+ widgets: ["columns"], // initialize column styling of the table
+ widgetColumns: { css: ["primary", "secondary", "tertiary" ] }
+ });
+});</pre></div>
+ </td>
+ <td><a href="example-widget-columns.html">Example</a></td>
</tr>
<tr id="widthfixed">
@@ -1040,18 +1059,15 @@
<strong id="Download-Required">Required:</strong>
<ul>
<li><a class="external" href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery">jQuery</a> (1.2.1 or higher)</li>
- <li><a href="../js/jquery.tablesorter.min.js">jquery.tablesorter.min.js</a> (12kb, Minified for production - please put the file on your server)</li>
+ <li><a href="../js/jquery.tablesorter.min.js">jquery.tablesorter.min.js</a> (17kb, Minified for production - please put the file on your server)</li>
</ul>
<strong id="Download-Addons">Optional/Add-Ons:</strong>
<ul>
<li><a class="external" href="http://plugins.jquery.com/files/jquery.metadata.2.1.zip">jQuery Metadata 2.1</a> (3,7kb <strong>Required for setting <a href="#Examples">inline options</a></strong>)</li>
- <!--
- <li><a class="external" href="http://dev.jquery.com/browser/trunk/plugins/dimensions/jquery.dimensions.
- .js?format=raw">jquery.dimensions.pack.js</a> (5,1kb, <a href="http://dean.edwards.name/packer/" class="external">packed</a>, for production. <strong>Required: for the <a href="example-pager.html">tablesorter pagination plugin</a></strong>)</li>
- -->
- <li><a href="../js/jquery.tablesorter.js">jquery.tablesorter.js</a> (17,7kb, for development)</li>
+ <li><a href="../js/jquery.tablesorter.js">jquery.tablesorter.js</a> (31kb, for development)</li>
<li><a href="../addons/pager/jquery.tablesorter.pager.js">jquery.tablesorter.pager.js</a> (3,6kb, <a href="example-pager.html">tablesorter pagination plugin</a>)</li>
+ <li><a href="../js/jquery.tablesorter.widgets.js">jquery.tablesorter.widgets.js</a> (2,12kb, includes the jQuery UI theme 'uitheme' and columns styling 'columns' widgets. <span class="tip"><em>New!</em></span> in v2.0.17.)</li>
</ul>
<!--
@@ -1065,7 +1081,7 @@
<ul>
<li><a href="../css/green/green.zip">Green Skin</a> - Images and CSS styles for green themed headers</li>
<li><a href="../css/blue/blue.zip">Blue Skin</a> - Images and CSS styles for blue themed headers (as seen in the examples)</li>
- <li><a href="example-ui-theme.html">jQuery UI Theme</a> - Apply any jQuery UI theme to the table using the "uitheme" widget code. <span class="tip"><em>New!</em></span> in v2.0.9!</li>
+ <li><a href="example-widget-ui-theme.html">jQuery UI Theme</a> - Apply any jQuery UI theme to the table using the "uitheme" widget code. <span class="tip"><em>New!</em></span> in v2.0.9!</li>
</ul>
<a name="Compatibility"></a>
View
8 index.html
@@ -13,18 +13,18 @@
<!-- Pick a theme, load the plugin & initialize plugin -->
<link href="css/blue/style.css" rel="stylesheet">
<script src="js/jquery.tablesorter.min.js"></script>
+ <script src="js/jquery.tablesorter.widgets.js"></script>
<script>
$(function(){
- $('table').tablesorter();
+ $('table').tablesorter({ widgets: ['zebra', 'columns'] });
});
</script>
</head>
<body>
<div class="demo">
-
- <h1><a href="https://github.com/Mottie/tablesorter">TableSorter</a></h1>
- <p>By Christian Bach; github updates by Rob G<br>
+ <h1><a href="https://github.com/Mottie/tablesorter">table<em>sorter</em></a></h1>
+ <p>By Christian Bach; github updates by <a href="https://github.com/Mottie/">Rob G</a><br>
<a href="docs/index.html">Complete docs included</a> (updated with missing docs from <a href="http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html">this blog post</a>)
</p>
View
3 js/jquery.tablesorter.js
@@ -1,6 +1,6 @@
/*
* TableSorter 2.0 - Client-side table sorting with ease!
-* Version 2.0.16
+* Version 2.0.17
* @requires jQuery v1.2.3
*
* Copyright (c) 2007 Christian Bach
@@ -94,6 +94,7 @@
parsers: {},
widgets: [],
widgetZebra: { css: ["even", "odd"] },
+ widgetColumns: { css: ["primary", "secondary", "tertiary" ] },
headers: {},
widthFixed: false,
cancelSelection: true,
View
4 js/jquery.tablesorter.min.js
@@ -1,7 +1,7 @@
/*
* TableSorter 2.0 - Client-side table sorting with ease!
-* Version 2.0.16 Minified using Google Closure Compiler (white space only)
+* Version 2.0.17 Minified using http://dean.edwards.name/packer/
* Copyright (c) 2007 Christian Bach
*/
-(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:"thead th", tableClass:"tablesorter",debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined")console.log(s);else alert(s)}function benchmark(s,d){log(s+","+((new Date).getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(config,node,cellIndex){var text="",te=config.textExtraction;if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(te==="simple")if(config.supportsTextContent)text=node.textContent; else if(node.childNodes[0]&&node.childNodes[0].hasChildNodes())text=node.childNodes[0].innerHTML;else text=node.innerHTML;else if(typeof te==="function")text=te(node);else if(typeof te==="object"&&te.hasOwnProperty(cellIndex))text=te[cellIndex](node);else text=$(node).text();return text}function getParserById(name){var i,l=parsers.length;for(i=0;i<l;i++)if(parsers[i].id.toLowerCase()===name.toLowerCase())return parsers[i];return false}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex]} function trimAndGetNodeText(config,node,cellIndex){return $.trim(getElementText(config,node,cellIndex))}function detectParserForColumn(table,rows,rowIndex,cellIndex){var i,l=parsers.length,node=false,nodeValue="",keepLooking=true;while(nodeValue===""&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node,cellIndex);if(table.config.debug)log("Checking if value was empty on row:"+rowIndex)}else keepLooking= false}for(i=1;i<l;i++)if(parsers[i].is(nodeValue,table,node))return parsers[i];return parsers[0]}function buildParserCache(table,$headers){if(table.tBodies.length===0)return;var rows=table.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(rows[0]){list=[];cells=rows[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$($headers[i]);if($.metadata&&h.metadata()&&h.metadata().sorter)p=getParserById(h.metadata().sorter);else if(table.config.headers[i]&&table.config.headers[i].sorter)p=getParserById(table.config.headers[i].sorter); else if(h.attr("class")&&h.attr("class").match("sorter-"))p=getParserById(h.attr("class").match(/sorter-(\w+)/)[1]||"");if(!p)p=detectParserForColumn(table,rows,-1,i);if(table.config.debug)parsersDebug+="column:"+i+" parser:"+p.id+"\n";list.push(p)}}if(table.config.debug)log(parsersDebug);return list}function buildCache(table){var b=table.tBodies[0],totalRows=b&&b.rows.length||0,totalCells=b.rows[0]&&b.rows[0].cells.length||0,parsers=table.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime; if(table.config.debug)cacheTime=new Date;for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j)cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j],j),table,c[0].cells[j]));cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(table.config.debug)benchmark("Building cache for "+totalRows+" rows:",cacheTime); return cache}function getWidgetById(name){var i,l=widgets.length;for(i=0;i<l;i++)if(widgets[i].id.toLowerCase()===name.toLowerCase())return widgets[i]}function applyWidget(table){var c=table.config.widgets,i,l=c.length;for(i=0;i<l;i++)getWidgetById(c[i]).format(table)}function appendToTable(table,cache){var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=totalRows?n[0].length-1:0,tableBody=$(table.tBodies[0]),rows=[],i,j,l,pos,appendTime;if(table.config.debug)appendTime=new Date;for(i= 0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){l=r[pos].length;for(j=0;j<l;j++)tableBody[0].appendChild(r[pos][j])}}if(table.config.appender)table.config.appender(table,rows);rows=null;if(table.config.debug)benchmark("Rebuilt table:",appendTime);applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd",table)},0)}function computeTableHeaderCellIndexes(t){var matrix=[],lookup={},thead=t.getElementsByTagName("THEAD")[0],trs=thead.getElementsByTagName("TR"), i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof matrix[rowIndex]==="undefined")matrix[rowIndex]=[];for(k=0;k<matrix[rowIndex].length+1;k++)if(typeof matrix[rowIndex][k]==="undefined"){firstAvailCol=k;break}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof matrix[k]=== "undefined")matrix[k]=[];matrixrow=matrix[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++)matrixrow[l]="x"}}}return lookup}function formatSortingOrder(v){if(typeof v!=="number")return v.toLowerCase().charAt(0)==="d"?1:0;else return v===1?1:0}function checkHeaderMetadata(cell){return $.metadata&&$(cell).metadata().sorter===false}function checkHeaderOptions(table,i){return table.config.headers[i]&&table.config.headers[i].sorter===false}function checkHeaderLocked(table,i){if(table.config.headers[i]&& table.config.headers[i].lockedOrder!==null)return table.config.headers[i].lockedOrder;return false}function checkHeaderOrder(table,i){if(table.config.headers[i]&&table.config.headers[i].sortInitialOrder)return table.config.headers[i].sortInitialOrder;return table.config.sortInitialOrder}function buildHeaders(table){var meta=$.metadata?true:false,header_index=computeTableHeaderCellIndexes(table),$th,lock,time,$tableHeaders;if(table.config.debug)time=new Date;$tableHeaders=$(table.config.selectorHeaders, table).wrapInner("<span/>").each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(table,index));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index)||$(this).is(".sorter-false"))this.sortDisabled=true;this.lockedOrder=false;lock=checkHeaderLocked(table,index);if(typeof lock!=="undefined"&&lock!==false)this.order=this.lockedOrder=formatSortingOrder(lock);if(!this.sortDisabled){$th=$(this).addClass(table.config.cssHeader); if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th,[index])}table.config.headerList[index]=this});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(table,rows,row){var i,cell,arr=[],r=table.tHead.rows,c=r[row].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1)arr=arr.concat(checkCellColSpan(table,rows,row++));else if(table.tHead.length===1||cell.rowSpan>1||!r[row+1])arr.push(cell)}return arr}function isValueInArray(v, a){var i,l=a.length;for(i=0;i<l;i++)if(a[i][0]===v)return true;return false}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[],i,l;$headers.each(function(offset){if(!this.sortDisabled)h[this.column]=$(this)});l=list.length;for(i=0;i<l;i++)h[list[i][0]].addClass(css[list[i][1]])}function fixColumnWidth(table,$headers){var c=table.config,colgroup;if(c.widthFixed){colgroup=$("<colgroup>");$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($("<col>").css("width", $(this).width()))});$(table).prepend(colgroup)}}function updateHeaderSortCount(table,sortList){var i,s,o,c=table.config,l=sortList.length;for(i=0;i<l;i++){s=sortList[i];o=c.headerList[s[0]];o.count=s[1];o.count++}}function getCachedSortType(parsers,i){return parsers?parsers[i].type:""}function multisort(table,sortList,cache){var dynamicExp="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=table.config,lc=cache.normalized.length,l=sortList.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug)sortTime= new Date;for(i=0;i<l;i++){c=sortList[i][0];order=sortList[i][1];s=getCachedSortType(tc.parsers,c)==="text"?order===0?"sortText":"sortTextDesc":order===0?"sortNumeric":"sortNumericDesc";e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(cache.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=tc.headers[c]?tc.string[tc.headers[c].string]||0:0}dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";dynamicExp+="if ("+e+") { return "+ e+"; } ";dynamicExp+="else { "}orgOrderCol=cache.normalized&&cache.normalized[0]?cache.normalized[0].length-1:0;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++)dynamicExp+="}; ";dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(tc.debug)benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);return cache}function sortText(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return a.localeCompare(b); if(a===b)return 0;try{var cnt=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(cnt<L&&a.charAt(cnt)===b.charAt(cnt)&&x.test(b.substring(cnt))===false&&x.test(a.substring(cnt))===false)cnt++;a=a.substring(cnt);b=b.substring(cnt);if(x.test(a)||x.test(b))if(x.test(a)===false)return a?1:-1;else if(x.test(b)===false)return b?-1:1;else{t=parseFloat(a)-parseFloat(b);if(t!==0)return t;else t=a.search(/[^\.\d]/);if(t===-1)t=b.search(/[^\.\d]/);a=a.substring(t);b=b.substring(t)}return a>b?1:-1}catch(er){return 0}} function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return b.localeCompare(a);return-sortText(a,b)}function getTextValue(a,mx,d){if(a==="")return(d||0)*Number.MAX_VALUE;if(mx){var i,l=a.length,n=mx+d;for(i=0;i<l;i++)n+=a.charCodeAt(i);return d*n}return 0}function sortNumeric(a,b,mx,d){if(a===""||isNaN(a))a=getTextValue(a,mx,d);if(b===""||isNaN(b))b=getTextValue(b,mx,d);return a-b}function sortNumericDesc(a,b,mx,d){if(a===""||isNaN(a))a=getTextValue(a,mx,d);if(b===""||isNaN(b))b= getTextValue(b,mx,d);return b-a}this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder,sortCSS,totalRows,$cell,i,j,a,s,o;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);tbl=$this=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);this.config.string={max:1,"max+":1, "max-":-1,none:0};cache=buildCache(this);sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){totalRows=$this[0].tBodies[0]&&$this[0].tBodies[0].rows.length||0;if(!this.sortDisabled){$this.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof this.lockedOrder!=="undefined"&&this.lockedOrder!==false)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j= 0;j<a.length;j++)if(a[j][0]!==i)config.sortList.push(a[j])}config.sortList.push([i,this.order])}else if(isValueInArray(i,config.sortList))for(j=0;j<config.sortList.length;j++){s=config.sortList[j];o=config.headerList[s[0]];if(s[0]===i){o.count=s[1];o.count++;s[1]=o.count%2}}else config.sortList.push([i,this.order]);if(config.sortAppend!==null){a=config.sortAppend;for(j=0;j<a.length;j++)if(a[j][0]!==i)config.sortList.push(a[j])}setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList, sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache))},1);return false}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);$this.trigger("sorton",[me.config.sortList])},1)}).bind("updateCell",function(e,cell){var config=this.config,pos=[cell.parentNode.rowIndex-1,cell.cellIndex];cache.normalized[pos[0]][pos[1]]= config.parsers[pos[1]].format(getElementText(config,cell,pos[1]),cell);$this.trigger("sorton",[config.sortList])}).bind("addRows",function(e,row){var i,config=this.config,rows=row.filter("tr").length,dat=[],l=row[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++)dat[j]=config.parsers[j].format(getElementText(config,row[i].cells[j],j),row[i].cells[j]);dat.push(cache.row.length);cache.row.push([row[i]]);cache.normalized.push(dat);dat=[]}$this.trigger("sorton",[config.sortList])}).bind("sorton",function(e, list){$(this).trigger("sortStart",tbl[0]);config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&$(this).metadata()&&$(this).metadata().sortlist)config.sortList=$(this).metadata().sortlist; if(config.sortList.length>0)$this.trigger("sorton",[config.sortList]);applyWidget(this)})};this.addParser=function(parser){var i,l=parsers.length,a=true;for(i=0;i<l;i++)if(parsers[i].id.toLowerCase()===parser.id.toLowerCase())a=false;if(a)parsers.push(parser)};this.addWidget=function(widget){widgets.push(widget)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return/^[\-+]?\d*$/.test($.trim(s.replace(/[,.']/g,"")))};this.clearTableBody=function(table){if($.browser.msie){var empty= function(){while(this.firstChild)this.removeChild(this.firstChild)};empty.apply(table.tBodies[0])}else table.tBodies[0].innerHTML=""}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});ts.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"}); ts.addParser({id:"currency",is:function(s){return/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/.test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.\-]/g),""))},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2)r+="0"+item;else r+=item}return $.tablesorter.formatFloat(r)},type:"numeric"});ts.addParser({id:"url", is:function(s){return/^(https?|ftp|file):\/\/$/.test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(s)},format:function(s){return $.tablesorter.formatFloat(s!==""?(new Date(s.replace(new RegExp(/-/g),"/"))).getTime():"0")},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""))},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat((new Date(s)).getTime())},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s)},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat==="us")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");else if(c.dateFormat==="uk")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");else if(c.dateFormat==="dd/mm/yy"||c.dateFormat==="dd-mm-yy")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");return $.tablesorter.formatFloat((new Date(s)).getTime())},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s)},format:function(s){return $.tablesorter.formatFloat((new Date("2000/01/01 "+s)).getTime())}, type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false},format:function(s,table,cell){var c=table.config,p=!c.parserMetadataName?"sortValue":c.parserMetadataName;return $(cell).metadata()[p]},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){var $tr,row=-1,odd,time;if(table.config.debug)time=new Date;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=row%2===0;$tr.removeClass(table.config.widgetZebra.css[odd? 0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug)$.tablesorter.benchmark("Applying Zebra widget",time)}})})(jQuery);
+(function($){$.extend({tablesorter:new function(){var g=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},widgetColumns:{css:["primary","secondary","tertiary"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:'thead th',tableClass:'tablesorter',debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===a.toLowerCase()){return g[i]}}return false}function getNodeFromRowAndCellIndex(a,b,c){return a[b].cells[c]}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=getNodeFromRowAndCellIndex(b,c,d);nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row:'+c)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){cols.push(g[j].format(getElementText(a.config,c[0].cells[j],j),a,c[0].cells[j]))}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime)}return cache}function getWidgetById(a){var i,l=widgets.length;for(i=0;i<l;i++){if(widgets[i].id.toLowerCase()===a.toLowerCase()){return widgets[i]}}}function applyWidget(a){var c=a.config.widgets,i,l=c.length;for(i=0;i<l;i++){getWidgetById(c[i]).format(a)}}function appendToTable(a,b){var c=b,r=c.row,n=c.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,tableBody=$(a.tBodies[0]),rows=[],i,j,l,pos,appendTime;if(a.config.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!a.config.appender){l=r[pos].length;for(j=0;j<l;j++){tableBody[0].appendChild(r[pos][j])}}}if(a.config.appender){a.config.appender(a,rows)}rows=null;if(a.config.debug){benchmark("Rebuilt table:",appendTime)}applyWidget(a);setTimeout(function(){$(a).trigger("sortEnd",a)},0)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){if(typeof(v)!=="number"){return(v.toLowerCase().charAt(0)==="d")?1:0}else{return(v===1)?1:0}}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var c=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders;if(b.config.debug){time=new Date()}$tableHeaders=$(b.config.selectorHeaders,b).wrapInner("<span/>").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).is('.sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)}if(!this.sortDisabled){$th=$(this).addClass(b.config.cssHeader);if(b.config.onRenderHeader){b.config.onRenderHeader.apply($th,[a])}}b.config.headerList[a]=this});if(b.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(b,c,d,e){c.removeClass(e[0]).removeClass(e[1]);var h=[],i,l;c.each(function(a){if(!this.sortDisabled){h[this.column]=$(this)}});l=d.length;for(i=0;i<l;i++){h[d[i][0]].addClass(e[d[i][1]])}}function fixColumnWidth(a,b){var c=a.config,colgroup;if(c.widthFixed){colgroup=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()))});$(a).prepend(colgroup)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1];o.count++}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time:",sortTime)}return d}function sortText(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare){return a.localeCompare(b)}if(a===b){return 0}try{var c=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(c<L&&a.charAt(c)===b.charAt(c)&&x.test(b.substring(c))===false&&x.test(a.substring(c))===false){c++}a=a.substring(c);b=b.substring(c);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(a===''){return(d||0)*Number.MAX_VALUE}if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,c,d){if(a===''||isNaN(a)){a=getTextValue(a,c,d)}if(b===''||isNaN(b)){b=getTextValue(b,c,d)}return a-b}function sortNumericDesc(a,b,c,d){if(a===''||isNaN(a)){a=getTextValue(a,c,d)}if(b===''||isNaN(b)){b=getTextValue(b,c,d)}return b-a}this.construct=function(d){return this.each(function(){if(!this.tHead||!this.tBodies){return}var c,$document,$headers,cache,config,shiftDown=0,sortOrder,sortCSS,totalRows,$cell,i,j,a,s,o;this.config={};config=$.extend(this.config,$.tablesorter.defaults,d);tbl=c=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);this.config.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){totalRows=(c[0].tBodies[0]&&c[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){c.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof(this.lockedOrder)!=="undefined"&&this.lockedOrder!==false){this.order=this.lockedOrder}if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){config.sortList.push(a[j])}}}config.sortList.push([i,this.order])}else{if(isValueInArray(i,config.sortList)){for(j=0;j<config.sortList.length;j++){s=config.sortList[j];o=config.headerList[s[0]];if(s[0]===i){o.count=s[1];o.count++;s[1]=o.count%2}}}else{config.sortList.push([i,this.order])}}if(config.sortAppend!==null){a=config.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){config.sortList.push(a[j])}}}setTimeout(function(){setHeadersCss(c[0],$headers,config.sortList,sortCSS);appendToTable(c[0],multisort(c[0],config.sortList,cache))},1);return false}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false}});c.bind("update",function(){var a=this;setTimeout(function(){a.config.parsers=buildParserCache(a,$headers);cache=buildCache(a);c.trigger("sorton",[a.config.sortList])},1)}).bind("updateCell",function(e,a){var b=this.config,pos=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[pos[0]][pos[1]]=b.parsers[pos[1]].format(getElementText(b,a,pos[1]),a);c.trigger("sorton",[b.sortList])}).bind("addRows",function(e,a){var i,config=this.config,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=config.parsers[j].format(getElementText(config,a[i].cells[j],j),a[i].cells[j])}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.trigger("sorton",[config.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);config.sortList=a;var b=config.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b,sortCSS);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist}if(config.sortList.length>0){c.trigger("sorton",[config.sortList])}applyWidget(this)})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.']/g,'')))};this.clearTableBody=function(a){if($.browser.msie){var b=function(){while(this.firstChild){this.removeChild(this.firstChild)}};b.apply(a.tBodies[0])}else{a.tBodies[0].innerHTML=""}}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[?$?$Yc?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.\-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/).test(s)},format:function(s,a){var c=a.config;s=s.replace(/\-/g,"/");if(c.dateFormat==="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2")}else if(c.dateFormat==="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1")}else if(c.dateFormat==="dd/mm/yy"||c.dateFormat==="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=-1,odd,time;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(i){b=$(this);if(!b.hasClass(a.config.cssChildRow)){row++}odd=(row%2===0);b.removeClass(a.config.widgetZebra.css[odd?0:1]).addClass(a.config.widgetZebra.css[odd?1:0])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
View
68 js/jquery.tablesorter.widgets.js
@@ -0,0 +1,68 @@
+/* TableSorter 2.0 Widgets */
+
+// Add jQuery UI theme widget
+$.tablesorter.addWidget({
+ id: "uitheme",
+ format: function(table) {
+ var c = table.config,
+ // ["up/down arrow (cssHeaders, unsorted)", "down arrow (cssDesc, descending)", "up arrow (cssAsc, ascending)" ]
+ icons = c.uitheme || ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"],
+ klass, rmv = icons.join(' ');
+ if (c.debug) {
+ time = new Date();
+ }
+ if (!$(c.headerList[0]).is('.ui-theme')) {
+ $(table).addClass('ui-widget ui-widget-content ui-corner-all');
+ $.each(c.headerList, function(){
+ $(this)
+ // using "ui-theme" class in case the user adds their own ui-icon using onRenderHeader
+ .addClass('ui-widget-header ui-corner-all ui-theme')
+ .append('<span class="ui-theme"/>');
+ });
+ }
+ $.each(c.headerList, function(i){
+ if (c.headers[i] && c.headers[i].sorter === false) {
+ // no sort arrows for disabled columns!
+ $(this).find('span.ui-theme').removeClass(rmv + ' ui-icon');
+ } else {
+ klass = ($(this).is('.' + c.cssAsc)) ? icons[1] : ($(this).is('.' + c.cssDesc)) ? icons[2] : $(this).is('.' + c.cssHeader) ? icons[0] : '';
+ $(this).find('span.ui-theme').removeClass(rmv).addClass(klass + ' ui-icon');
+ }
+ });
+ if (c.debug) {
+ $.tablesorter.benchmark("Applying uitheme widget", time);
+ }
+ }
+});
+
+// Add Column styles widget
+$.tablesorter.addWidget({
+ id: "columns",
+ format: function(table) {
+ var $td, time, i,
+ c = table.config,
+ list = c.sortList,
+ len = list.length,
+ css = c.widgetColumns.css,
+ last = css.length-1,
+ rmv = css.join(' ');
+ if (c.debug) {
+ time = new Date();
+ }
+ // loop through the visible rows
+ $("tr:visible", table.tBodies[0]).each(function (i) {
+ $td = $(this).children().removeClass(rmv);
+ // primary sort column class
+ $td.eq(list[0][0]).addClass(css[0]);
+ if (len > 1) {
+ for (i=1; i<len; i++){
+ // secondary, tertiary, etc sort column classes
+ $td.eq(list[i][0]).addClass( css[i] || css[last] );
+ }
+ }
+ });
+ if (c.debug) {
+ $.tablesorter.benchmark("Applying Columns widget", time);
+ }
+ }
+});

0 comments on commit db0863f

Please sign in to comment.
Something went wrong with that request. Please try again.