diff --git a/README.markdown b/README.markdown index 0eb35347..94ef2764 100644 --- a/README.markdown +++ b/README.markdown @@ -28,6 +28,17 @@ 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.19 (2011-09-16) + +* Added code in attempt to clear the table headers between multiple tables - fix for [issue #2](https://github.com/Mottie/tablesorter/issues/2). +* Cleaned up some code and wrapped the widget code to prevent conflicts with other javascript libraries. +* Updated the columns widget: + * Added css examples to the [demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html). + * Removed the `widgetColumns` option from the core, but it is still used by the widget - the way it is used hasn't changed. +* Updated the uitheme widget: + * Added `widgetUitheme` option - used by the widget, but not included in the core. See the demo for a better example. + * Example added to the [uitheme widget demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html). + #### Version 2.0.18.1 (2011-09-14) * Updated the "uitheme" widget with method to add zebra striping and hovered header classes. diff --git a/changelog.txt b/changelog.txt index fa72db02..64143c05 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,17 @@ TableSorter Change Log +Version 2.0.19 (2011-09-16) +============================ + +* Added code in attempt to clear the table headers between multiple tables - fix for [issue #2](https://github.com/Mottie/tablesorter/issues/2). +* Cleaned up some code and wrapped the widget code to prevent conflicts with other javascript libraries. +* Updated the columns widget: + * Added css examples to the [demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html). + * Removed the `widgetColumns` option from the core, but it is still used by the widget - the way it is used hasn't changed. +* Updated the uitheme widget: + * Added `widgetUitheme` option - used by the widget, but not included in the core. See the demo for a better example. + * Example added to the [uitheme widget demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html). + Version 2.0.18.1 (2011-09-14) ============================ diff --git a/docs/css/jq.css b/docs/css/jq.css index 129ba911..f2bc16e6 100644 --- a/docs/css/jq.css +++ b/docs/css/jq.css @@ -11,6 +11,9 @@ table.tablesorter table.info tbody th,table.tablesorter table.info tbody td{bord table.tablesorter table.info tbody th{background:#eee;} #options{width:100%;} #options pre{width:95%;} +#options .property{width:115px;} +#options .type{width:80px; } +#options .defaults{width:200px;} #options .examples{width:60px;} pre,#display{overflow-x:auto;padding:15px;border:1px solid #ddd;border-left-width:5px;} pre,#display,code.hilight{background-color:#eee;color:#333;font-size:small;list-style:none;} diff --git a/docs/example-widget-columns.html b/docs/example-widget-columns.html index 798f5f92..38a46044 100644 --- a/docs/example-widget-columns.html +++ b/docs/example-widget-columns.html @@ -25,9 +25,12 @@ // 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" ] }, @@ -120,6 +123,36 @@

 	
 
+	

CSS

+
+
/*
+ This css is part of the blue/style.css theme, shown as an example
+ To work with the zebra widget, include the .odd and .even color definitions as well
+ as definitions for the "primary", "secondary" and "tertiary" sorts.
+*/
+/* 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;
+}
+
+

HTML


diff --git a/docs/example-widget-ui-theme.html b/docs/example-widget-ui-theme.html
index c9110c80..d8ae6b09 100644
--- a/docs/example-widget-ui-theme.html
+++ b/docs/example-widget-ui-theme.html
@@ -29,10 +29,17 @@
 
 	// 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', 'zebra'],
+
 		// adding zebra striping, using content and default styles - the ui css removes the background from default
-		widgetZebra: { css: ["ui-widget-content", "ui-state-default"] }
+		widgetZebra: { css: ["ui-widget-content", "ui-state-default"] },
+
+		// change default uitheme icons - find the full list of icons here: http://jqueryui.com/themeroller/ (hover over them for their name)
+		// default icons: { css: ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"] }
+		// { css : ["up/down arrow (cssHeaders/unsorted)", "down arrow (cssDesc/descending)", "up arrow (cssAsc/ascending)" ] }
+		widgetUitheme: { css: ["ui-icon-carat-2-n-s", "ui-icon-carat-1-s", "ui-icon-carat-1-n"] }
 	});
 
 });
diff --git a/docs/index.html b/docs/index.html
index fea238cf..2c76b8da 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -19,8 +19,8 @@
 
 
@@ -345,10 +345,10 @@
 	
-				
-				
-				
-				
+				
+				
+				
+				
@@ -701,6 +701,7 @@
 					Built-in options include "simple" and "complex".  Use complex if you have data marked up
 					inside of a table cell like: <td><strong><em>123 Main Street</em></strong></td>.
 					
+
Complex can be slow in large tables so consider writing your own text extraction function "myTextExtraction" which you define like:
var myTextExtraction = function(node){
   // extract data from markup and return it
@@ -742,10 +743,11 @@ $(function(){
 			
- + - + + + + + + + + + @@ -1067,17 +1089,10 @@ $(table) - - Themes:'); + if (table.config.widthFixed) { + var colgroup = $(''); $("tr:first td", table.tBodies[0]).each(function () { colgroup.append($('').css('width', $(this).width())); }); diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 1838af4e..5281c5ee 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,7 +1,7 @@ /* * TableSorter 2.0 - Client-side table sorting with ease! -* Version 2.0.18 Minified using http://dean.edwards.name/packer/ +* Version 2.0.19 Minified using http://dean.edwards.name/packer/ * Copyright (c) 2007 Christian Bach */ -(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").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;i1){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');$("tr:first td",a.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()))});$(a).prepend(colgroup)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;ib)?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;i0){c.trigger("sorton",[config.sortList])}applyWidget(this)})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i").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(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this});if(c.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;i1){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');$("tr:first td",a.tBodies[0]).each(function(){c.append($('').css('width',$(this).width()))});$(a).prepend(c)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;ib)?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;i0){c.trigger("sorton",[config.sortList])}applyWidget(this)})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i
PropertyTypeDefaultDescriptionPropertyTypeDefaultDescription Link
widgetZebra Object with Array{css:["even","odd"]}{ css: [ "even", "odd" ] } When the zebra striping widget is initialized, it automatically applied the default class names of "even" and "odd".
+
Use the "widgetZebra" option to change the css class name as follows:
$(function(){
   $("table").tablesorter({
@@ -760,10 +762,11 @@ $(function(){
 			
widgetColumns Object with Array{css:[ "primary", "secondary", "tertiary" ]}{ css:[ "primary", "secondary", "tertiary" ] } When the column styling widget is initialized, it automatically applied the default class names of "primary" for the primary sort, "secondary" for the next sort, "tertiary" for the next sort, and so on (add more as needed)... New! in v2.0.17.
+
Use the "widgetColumns" option to change the css class name as follows:
$(function(){
   $("table").tablesorter({
@@ -775,6 +778,25 @@ $(function(){
 				
Example
widgetUithemeObject with Array{ css: ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"] } + Used when the ui theme styling widget is initialized. It automatically applies the default class names of "ui-icon-arrowthick-2-n-s" for the unsorted column, "ui-icon-arrowthick-1-s" for the descending sort and "ui-icon-arrowthick-1-n" for the ascending sort. New! in v2.0.9. +
+
+ Use the "widgetUitheme" option to change the css class name as follows: +
$(function(){
+  $("table").tablesorter({
+    widgets: ["uitheme"], // initialize ui theme styling widget of the table
+    widgetUitheme: { css: ["ui-icon-carat-2-n-s", "ui-icon-carat-1-s", "ui-icon-carat-1-n"] }
+  });
+});
+
Example
widthFixed Boolean