diff --git a/README.md b/README.md index d8eecb12..00498cee 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,28 @@ tablesorter can successfully parse and sort many types of data including linked View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). +#### Version 2.7.4 (1/29/2013) + +* Fixed an problem with the pager not pointing to a tbody, and breaking on an empty tbody. See [issue #223](https://github.com/Mottie/tablesorter/issues/223). +* Modified core to always add a `` to the table. Only when the `widthFixed` option is `true` will it add percentage based widths. +* Modified the parsers code to no longer require an `is` function; or if the function is missing, no error will be thrown. +* Modified the isoDate and usLongDate parsers: + * isoDate parser will now auto-detect dates with times + * usLongDate parser will now auto-detect dates in this format: "DD MMMMMMMMM YYYY" (25 Jan 2013) +* Added manifest files: + * `component.json` for bower package manager. Thanks to [appleboy](https://github.com/appleboy); also see [issue #190](https://github.com/Mottie/tablesorter/issues/190). + * `tablesorter.jquery.json` for the jquery plugin registry. +* Added `"updateRows"` method which is the exact same as `"update"`, but needed due to issues with Prototype. See [issue #217](https://github.com/Mottie/tablesorter/issues/217). +* Added `pageSize` method to change the pager page size more easily. See [issue #218](https://github.com/Mottie/tablesorter/issues/218). +* Added [filter widget change log](https://github.com/Mottie/tablesorter/wiki/Change3) to the wiki pages. +* Added a config variable `config.columns`: + * This variable indicates the number of columns in the table. + * Previously, `config.parsers.length` or `config.$headers.length` were used. Neither of which were accurate if the table was empty or multiple rows in the header existed. + * This value may still be inaccurate if a rowspan is used in the header. +* Updated index page to use jQuery 1.9. + * jQuery 2.0 is has a [bug adding rows to the table](http://jsfiddle.net/Mottie/abkNM/324/), so I didn't upgrade the demos to use it. + * Changed syntax highlighting script from chilli to google's prettify. + #### Version 2.7.3 (1/10/2013) * Fixed a serious bug in the filter widget that was breaking the widget completely if `filter_functions` was not defined (introduced in v2.7.2). Fixes [issue #213](https://github.com/Mottie/tablesorter/issues/213). diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index c46122a2..8d86772f 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,6 +1,6 @@ /*! * tablesorter pager plugin - * updated 1/4/2013 + * updated 1/29/2013 */ /*jshint browser:true, jquery:true, unused:false */ ;(function($) { @@ -138,7 +138,7 @@ if (h) { d = h - $b.height(); if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) { - $b.append(''); + $b.append(''); } } } @@ -189,7 +189,7 @@ $t = $(table), tc = table.config, hl = $t.find('thead th').length, tds = '', - err = '' + + err = '' + (exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '', result = c.ajaxProcessing(data) || [ 0, [] ], d = result[1] || [], diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index 6249b976..d87e8190 100644 --- a/addons/pager/jquery.tablesorter.pager.min.js +++ b/addons/pager/jquery.tablesorter.pager.min.js @@ -1,2 +1,2 @@ -/*! tablesorter pager plugin minified - updated 1/4/2013 */ -;(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0}; var p=this,s=function(b,a){var c=b.cssDisabled,f=!!a,h=Math.min(b.totalPages,b.filteredPages);b.updateArrows&&(d(b.cssFirst+","+b.cssPrev,b.container)[f||0===b.page?"addClass":"removeClass"](c),d(b.cssNext+","+b.cssLast,b.container)[f||b.page===h-1?"addClass":"removeClass"](c))},u=function(b,a){var c,f,h;c=d(b).hasClass("hasFilters")&&!a.ajaxUrl;a.filteredRows=c?b.config.$tbodies.children("tr:not(.filtered,.remove-me)").length:a.totalRows;a.filteredPages=c?Math.ceil(a.filteredRows/a.size):a.totalPages; if(0a.filteredRows,a.startRow=h?1:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),f=d(a.cssPageDisplay,a.container),c=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}), f[0]&&(f["INPUT"===f[0].tagName?"val":"html"](c),d(a.cssGoto,a.container).length))){h="";f=Math.min(a.totalPages,a.filteredPages);for(c=1;c<=f;c++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(b).trigger("pagerComplete",a)},t=function(b,a){var c,f=d(b.tBodies[0]);if(a.fixedHeight&&(f.find("tr.pagerSavedHeightSpacer").remove(),c=d.data(b,"pagerSavedHeight")))c-=f.height(),5')},w=function(b,a){var c=d(b.tBodies[0]);c.find("tr.pagerSavedHeightSpacer").remove();d.data(b,"pagerSavedHeight",c.height());t(b,a);d.data(b,"pagerLastSize",a.size)},n=function(b,a){if(!a.ajaxUrl){var c,f=d(b.tBodies).children("tr:not(."+b.config.cssChildRow+")"),h=f.length,e=a.page*a.size,g=e+a.size,k=0;for(c=0;c=e&& k'+(f?f.message+" ("+f.name+")":"No rows found")+"",n=c.ajaxProcessing(b)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[b][h]+"";q+=""}r&&r.length===y&&(e=j.hasClass("hasStickyHeaders"),k=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),g=j.find("tfoot tr:first").children(),j.find("th."+l.cssHeader).each(function(a){var b=d(this),c;b.find("."+l.cssIcon).length?(c=b.find("."+ l.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(r[a]).append(c),e&&k.length&&(c=k.find("th").eq(a).find("."+l.cssIcon).clone(!0),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]).append(c))):(b.find(".tablesorter-header-inner").html(r[a]),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]));g.eq(a).html(r[a])}));j.find("thead tr."+c.cssErrorRow).remove();f?j.find("thead").append(m):E.html(q);l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update"); c.totalRows=n[0]||0;c.totalPages=Math.ceil(c.totalRows/c.size);u(a,c);t(a,c);c.initialized&&j.trigger("pagerChange",c)}c.initialized||(c.initialized=!0,d(a).trigger("pagerInitialized",c))},v=function(b,a,c){c.isDisabled=!1;var f,h,e,g=document.createDocumentFragment(),k=a.length;f=c.page*c.size;var j=f+c.size;if(!(1>k)){c.initialized&&d(b).trigger("pagerChange",c);if(c.removeRows){j>a.length&&(j=a.length);d(b.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(b);f=c.totalPages&&A(b,c);u(b,c);c.isDisabled||t(b,c);d(b).trigger("applyWidgets")}},B=function(b,a){a.ajax?s(a,!0):(a.isDisabled=!0,d.data(b,"pagerLastPage",a.page),d.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",b.tBodies[0]).remove(),v(b,b.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+ a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(b,a){if(!a.isDisabled){var c=Math.min(a.totalPages,a.filteredPages);if(0>a.page||a.page>c-1)a.page=0;if(a.ajax){var f,c=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=b.config.sortList,e=a.currentFilters||[],g=c.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=c.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];g&&(g=g[1],d.each(h,function(a,b){j.push(g+"["+b[0]+"]="+b[1])}),c=c.replace(/\{sortList[\s+]?:[\s+]?([^\}]*)\}/g, j.length?j.join("&"):g));k&&(k=k[1],d.each(e,function(a,b){b&&j.push(k+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));f=c;c=b.config;""!==f&&(c.showProcessing&&d.tablesorter.isProcessing(b,!0),d(document).bind("ajaxError.pager",function(c,e,g,h){g.url===f&&(z(null,b,a,h),d(document).unbind("ajaxError.pager"))}),d.getJSON(f,function(c){z(c,b,a);d(document).unbind("ajaxError.pager")}))}else a.ajax||v(b,b.config.rowsCopy,a);d.data(b,"pagerLastPage", a.page);d.data(b,"pagerUpdateTriggered",!0);a.initialized&&d(b).trigger("pageMoved",a)}},C=function(b,a,c){c.size=a;d.data(b,"pagerLastPage",c.page);d.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);m(b,c)},F=function(b,a){a.page=0;m(b,a)},A=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;m(b,a)},G=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);m(b,a)},H=function(b,a){a.page--;0>=a.page&& (a.page=0);m(b,a)},D=function(b,a,c){var f=d(a.cssPageSize,a.container).removeClass(a.cssDisabled).removeAttr("disabled");d(a.container).find(a.cssGoto).removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=d.data(b,"pagerLastPage")||a.page||0;a.size=d.data(b,"pagerLastSize")||parseInt(f.find("option[selected]").val(),10)||a.size;f.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(d(b).trigger("update"),C(b,a.size,a),x(b,a),t(b,a))};p.appender= function(b,a){var c=b.config.pager;c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=d.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),v(b,a,c))};p.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,f,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults,b),g=this,k=g.config,j=d(g),l=d(e.container).addClass("tablesorter-pager").show();h.appender=p.appender;j.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager").bind("filterStart.pager", function(a,b){d.data(g,"pagerUpdateTriggered",!1);e.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){d.data(g,"pagerUpdateTriggered")?d.data(g,"pagerUpdateTriggered",!1):("filterEnd"===a.type&&(e.page=0),u(g,e),m(g,e),t(g,e))}).bind("disable.pager",function(){B(g,e)}).bind("enable.pager",function(){D(g,e,!0)}).bind("destroy.pager",function(){B(g,e);d(e.container).hide();g.config.appender=null;d(g).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager", function(){n(g,e)});c=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];f=[F,H,G,A];l.find(c.join(",")).unbind("click.pager").bind("click.pager",function(){var a,b=d(this),h=c.length;if(!b.hasClass(e.cssDisabled))for(a=0;aa.filteredRows,a.startRow=h?1:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=d(a.cssPageDisplay,a.container),c=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}), g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](c),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(c=1;c<=g;c++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(b).trigger("pagerComplete",a)},u=function(b,a){var c,g=d(b.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),c=d.data(b,"pagerSavedHeight")))c-=g.height(),5')},w=function(b,a){var c=d(b.tBodies[0]);c.find("tr.pagerSavedHeightSpacer").remove();d.data(b,"pagerSavedHeight",c.height());u(b,a);d.data(b,"pagerLastSize",a.size)},n=function(b,a){if(!a.ajaxUrl){var c,g=d(b.tBodies).children("tr:not(."+b.config.cssChildRow+")"),h=g.length,e=a.page*a.size,f=e+a.size,k=0;for(c=0;c=e&&k'+(g?g.message+" ("+g.name+")":"No rows found")+"",n=c.ajaxProcessing(b)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[b][h]+"";q+=""}r&&r.length===y&&(e=j.hasClass("hasStickyHeaders"),k=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),f=j.find("tfoot tr:first").children(),j.find("th."+l.cssHeader).each(function(a){var b=d(this),c;b.find("."+l.cssIcon).length?(c=b.find("."+ l.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(r[a]).append(c),e&&k.length&&(c=k.find("th").eq(a).find("."+l.cssIcon).clone(!0),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]).append(c))):(b.find(".tablesorter-header-inner").html(r[a]),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]));f.eq(a).html(r[a])}));j.find("thead tr."+c.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q);l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update"); c.totalRows=n[0]||0;c.totalPages=Math.ceil(c.totalRows/c.size);t(a,c);u(a,c);c.initialized&&j.trigger("pagerChange",c)}c.initialized||(c.initialized=!0,d(a).trigger("pagerInitialized",c))},v=function(b,a,c){c.isDisabled=!1;var g,h,e,f=document.createDocumentFragment(),k=a.length;g=c.page*c.size;var j=g+c.size;if(!(1>k)){c.initialized&&d(b).trigger("pagerChange",c);if(c.removeRows){j>a.length&&(j=a.length);d(b.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(b);g=c.totalPages&&A(b,c);t(b,c);c.isDisabled||u(b,c);d(b).trigger("applyWidgets")}},B=function(b,a){a.ajax?s(a,!0):(a.isDisabled=!0,d.data(b,"pagerLastPage",a.page),d.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",b.tBodies[0]).remove(),v(b,b.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+ a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(b,a){if(!a.isDisabled){var c=Math.min(a.totalPages,a.filteredPages);if(0>a.page||a.page>c-1)a.page=0;if(a.ajax){var g,c=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=b.config.sortList,e=a.currentFilters||[],f=c.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=c.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];f&&(f=f[1],d.each(h,function(a,b){j.push(f+"["+b[0]+"]="+b[1])}),c=c.replace(/\{sortList[\s+]?:[\s+]?([^\}]*)\}/g, j.length?j.join("&"):f));k&&(k=k[1],d.each(e,function(a,b){b&&j.push(k+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));g=c;c=b.config;""!==g&&(c.showProcessing&&d.tablesorter.isProcessing(b,!0),d(document).bind("ajaxError.pager",function(c,e,f,h){f.url===g&&(z(null,b,a,h),d(document).unbind("ajaxError.pager"))}),d.getJSON(g,function(c){z(c,b,a);d(document).unbind("ajaxError.pager")}))}else a.ajax||v(b,b.config.rowsCopy,a);d.data(b,"pagerLastPage", a.page);d.data(b,"pagerUpdateTriggered",!0);a.initialized&&d(b).trigger("pageMoved",a)}},C=function(b,a,c){c.size=a;d.data(b,"pagerLastPage",c.page);d.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);m(b,c)},E=function(b,a){a.page=0;m(b,a)},A=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;m(b,a)},F=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);m(b,a)},G=function(b,a){a.page--;0>=a.page&& (a.page=0);m(b,a)},D=function(b,a,c){var g=d(a.cssPageSize,a.container).removeClass(a.cssDisabled).removeAttr("disabled");d(a.container).find(a.cssGoto).removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=d.data(b,"pagerLastPage")||a.page||0;a.size=d.data(b,"pagerLastSize")||parseInt(g.find("option[selected]").val(),10)||a.size;g.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(d(b).trigger("update"),C(b,a.size,a),x(b,a),u(b,a))};p.appender= function(b,a){var c=b.config.pager;c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=d.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),v(b,a,c))};p.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,g,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults,b),f=this,k=f.config,j=d(f),l=d(e.container).addClass("tablesorter-pager").show();h.appender=p.appender;j.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager", function(a,b){d.data(f,"pagerUpdateTriggered",!1);e.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){d.data(f,"pagerUpdateTriggered")?d.data(f,"pagerUpdateTriggered",!1):("filterEnd"===a.type&&(e.page=0),t(f,e),m(f,e),u(f,e))}).bind("disable.pager",function(){B(f,e)}).bind("enable.pager",function(){D(f,e,!0)}).bind("destroy.pager",function(){B(f,e);d(e.container).hide();f.config.appender=null;d(f).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager", function(){n(f,e)}).bind("pageSize.pager",function(a,b){e.size=parseInt(b,10)||10;n(f,e);t(f,e)});c=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];g=[E,G,F,A];l.find(c.join(",")).unbind("click.pager").bind("click.pager",function(){var a,b=d(this),h=c.length;if(!b.hasClass(e.cssDisabled))for(a=0;a=1.2.6" - } + "name": "tablesorter", + "version": "2.7.4", + "dependencies": { + "jqueryjs": ">=1.2.6" + } } \ No newline at end of file diff --git a/docs/example-parsers.html b/docs/example-parsers.html index 2883ca56..8291cbdc 100644 --- a/docs/example-parsers.html +++ b/docs/example-parsers.html @@ -22,10 +22,10 @@ $.tablesorter.addParser({ // set a unique id id: 'grades', -// is: function(s) { + is: function(s) { // return false so this parser is not auto detected -// return false; -// }, + return false; + }, format: function(s, table, cell, cellIndex) { // format your data for normalization return s.toLowerCase() diff --git a/docs/example-widget-resizable.html b/docs/example-widget-resizable.html index 122ce343..4ce05320 100644 --- a/docs/example-widget-resizable.html +++ b/docs/example-widget-resizable.html @@ -49,19 +49,31 @@
  • This widget can be applied to the original plugin. The code is in the "jquery.tablesorter.widgets.js" file.
  • This widget now saves all changed column widths to local storage, or it falls back to a cookie! (v2.1)
  • Column width saving requires the new "$.tablesorter.storage()" function included with the "jquery.tablesorter.widgets.js" file (v2.1).
  • -
  • Right clicking (opening the context menu) will now reset the resized columns. New! v2.4
  • -
  • Because this widget uses jQuery's closest() function, it requires jQuery 1.3+ in order to work.
  • -
  • Because this widget uses jQuery's parseJson() function, it requires jQuery version 1.4.1+ in order to save the widths.
  • +
  • Right clicking (opening the context menu) will now reset the resized columns (v2.4).
  • +
  • Holding down the shift key while resizing will force the last column or the table to resize instead of the next column, but only if the table is full width. New! v2.7.4.
  • +
  • Prevent resizing a column by adding any of the following (they all do the same thing), set in order of priority New! v2.7.4: +
      +
    • jQuery data data-resizable="false".
    • +
    • metadata class="{ resizable: 'false'}". This requires the metadata plugin.
    • +
    • headers option headers : { 0 : { resizable : 'false' } }.
    • +
    • header class name class="resizable-false".
    • +
    +
  • +
  • Setting the resizable widget option to false, will only prevent the saving of resized columns, it has nothing to do with preventing a column from being resized.
  • +
  • Because this widget uses jQuery's closest() (jQuery 1.3+) and index() (jQuery 1.4+) functions, it requires these newer versions of jQuery in order to work.
  • +
  • In order to save the resized widths, jQuery version 1.4.1+ should be used because jQuery's parseJson() function is needed.
  • Demo

    -
    +
    +

    Non-full width table (individual columns resize)

    +
    - + @@ -109,7 +121,64 @@ -
    First Name Last NameAgeAge Total Discount DateJan 18, 2007 9:12 AM
    + + +

    Full width table (use shift to force last column to resize)

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    First NameLast NameAgeTotalDiscountDate
    PeterParker28$9.9920%Jul 6, 2006 8:14 AM
    JohnHood33$19.9925%Dec 10, 2002 5:14 AM
    ClarkKent18$15.8944%Jan 12, 2003 11:14 AM
    BruceAlmighty45$153.1944%Jan 18, 2001 9:12 AM
    BruceEvans22$13.1911%Jan 18, 2007 9:12 AM
    +

    Page Header

    @@ -128,8 +197,23 @@

    HTML

    -
    -
    
    +	
    +
    <!-- The Age column is set to not be resizable -->
    +<table class="tablesorter" style="width:auto">
    +  <thead>
    +    <tr>
    +      <th>First Name</th>
    +      <th>Last Name</th>
    +      <th class="resizable-false">Age</th>
    +      <th>Total</th>
    +      <th>Discount</th>
    +      <th>Date</th>
    +    </tr>
    +  </thead>
    +  <tbody>
    +    ...
    +  </tbody>
    +</table>
    diff --git a/docs/example-widget-ui-theme.html b/docs/example-widget-ui-theme.html index 0aa6b49f..f5d08fe1 100644 --- a/docs/example-widget-ui-theme.html +++ b/docs/example-widget-ui-theme.html @@ -46,18 +46,21 @@ // call the tablesorter plugin and apply the ui theme widget $("table").tablesorter({ + theme : 'jui', // theme "jui" and "bootstrap" override the uitheme widget option in v2.7+ + headerTemplate : '{content} {icon}', // needed to add icon for jui theme // widget code now contained in the jquery.tablesorter.widgets.js file - widgets : ['uitheme', 'zebra', 'resizable'], + widgets : ['uitheme', 'zebra'], widgetOptions : { // zebra striping class names - the uitheme widget adds the class names defined in // $.tablesorter.themes to the zebra widget class names zebra : ["even", "odd"], - // set the uitheme widget to use the jQuery UI theme class names ## NEW ## - uitheme : 'jui' + // set the uitheme widget to use the jQuery UI theme class names + // ** this is now optional, and will be overridden if the theme name exists in $.tablesorter.themes ** + // uitheme : 'jui' } }); @@ -82,14 +85,14 @@
  • This widget can be applied to the original plugin. The code is in the "jquery.tablesorter.widgets.js" file.
  • You will need to modify the headerTemplate option to include the bootstrap icon! See the example in the code. New! v2.7!
  • The original "widgetUitheme" option has been replaced by "widgetOptions.uitheme". See the javascript block below for more details (v2.1).
  • -
  • New! In tablesorter v2.4, the uitheme option has changed to indicate the theme instead of an array of icons to use: +
  • In tablesorter v2.4, the uitheme option has changed to indicate the theme instead of an array of icons to use:
    • All theme class names are now contained within $.tablesorter.themes with the jQuery UI theme saved to $.tablesorter.themes.jui
    • The themes variable allows you to modify the class names for the table, header, sort icons, active state, hover state, filter inputs and zebra striping. See the code below on how to extend these variables.
    • Set the uitheme widget option to "jui" to set the widget to use the jQuery UI theme. See the bootstrap demo for another example.
  • -
  • Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4 requires jQuery 1.2.6+.
  • +
  • Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4+ requires jQuery 1.2.6+.
  • diff --git a/docs/index.html b/docs/index.html index 22963319..95bf7d0b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -267,15 +267,15 @@
  • Lock sort order
  • Set initial sort order
  • Using sortReset & sortRestart options
  • -
  • Resetting the entire table sort (sortReset method) New! v2.4.7
  • -
  • Using selectorSort option New! v2.4
  • +
  • Resetting the entire table sort (sortReset method) (v2.4.7)
  • +
  • Using selectorSort option (v2.4)
  • Sorting empty cells (v2.1.11)
  • Change the default multi-sorting key
  • Custom sort script (v2.2)
  • Sorting Accented Characters (v2.24; languages)
  • Sorting with Multiple Tbodies (v2.2)
  • Sorting Across Multiple Columns (v2.3)
  • -
  • Show a processing icon during sorting/filtering New! v2.4
  • +
  • Show a processing icon during sorting/filtering (v2.4)
  • Parsers / Extracting Content

    @@ -296,16 +296,16 @@
  • Columns widget (v2.0.17)
  • Filter widget (v2.0.18)
  • Filter widget, custom (v2.3.6)
  • -
  • UITheme widget - jQuery UI theme (v2.0.9; Modified! v2.4)
  • -
  • UITheme widget - Bootstrap New! v2.4
  • -
  • Resizable Columns widget (v2.0.23.1)
  • +
  • UITheme widget - jQuery UI theme (v2.0.9; Modified v2.4)
  • +
  • UITheme widget - Bootstrap (v2.4)
  • +
  • Resizable Columns widget (v2.0.23.1; Modified v2.7.4)
  • Save sort widget (v2.0.27)
  • Sticky header widget (v2.0.21.1)
  • Zebra stripe widget
  • Widgets, writing your own
  • Pager plugin
  • Pager plugin - ajax (v2.1)
  • -
  • Pager plugin + filter widget New! v2.4
  • +
  • Pager plugin + filter widget (v2.4)
  • @@ -413,7 +413,7 @@ cssChildRow String "tablesorter-childRow" - Add this css class to a child row that should always be attached to its parent. Click on the "cssChildRow" link to toggle the view on the attached child row. Previous default was "expand-child", Changed! in v2.4. + Add this css class to a child row that should always be attached to its parent. Click on the "cssChildRow" link to toggle the view on the attached child row. Previous default was "expand-child" (Changed in v2.4). Ex:1 2 @@ -502,7 +502,7 @@ cssHeaderRow String "tablesorter-headerRow" - The CSS style used to style the header row. New! v2.4. + The CSS style used to style the header row (v2.4).
    Previously the row would get the same class as the header cells, this class was added to make it easier to determine what element was being targetted in the plugin.
    @@ -528,7 +528,7 @@ cssProcessing String "tablesorter-processing" - This class name is added to the header cell that is currently being sorted or filted. To prevent this class name from being added, set the showProcessing option to false. New! v2.4. + This class name is added to the header cell that is currently being sorted or filted. To prevent this class name from being added, set the showProcessing option to false (v2.4). @@ -693,7 +693,9 @@ // See the "Applying the filter widget" demo 7: { filter: false }, // disable filter widget for this column 8: { filter: "parsed" }, // use parsed data for this column in the filter search - 9: { filter: "noquicksearch" } // exclude this column from the advanced filter quick search + + // Set resizable widget options for this column + 9: { resizable: false } // prevent resizing of column 9 } }); @@ -845,7 +847,7 @@ From the example function above, you'll end up with something similar to this HT jQuery selectors used to find cells in the header.
    You can change this, but the table will still need the required thead and tbody before this plugin will work properly. -
    Added > to the selector in v2.3 to prevent targetting nested table headers. It was modified again in v2.4 to include td cells within the thead. Modified! v2.4. +
    Added > to the selector in v2.3 to prevent targetting nested table headers. It was modified again in v2.4 to include td cells within the thead.
    @@ -868,7 +870,7 @@ From the example function above, you'll end up with something similar to this HT selectorSort String "th, td" - jQuery selector of content within selectorHeaders that is clickable to trigger a sort. New! v2.4. + jQuery selector of content within selectorHeaders that is clickable to trigger a sort (v2.4). Example @@ -876,7 +878,7 @@ From the example function above, you'll end up with something similar to this HT serverSideSorting Boolean false - Set to true if the server is performing the sorting. The ui and events will still be used. New! v2.5.3. + Set to true if the server is performing the sorting. The ui and events will still be used (v2.5.3). @@ -884,7 +886,7 @@ From the example function above, you'll end up with something similar to this HT showProcessing Boolean false - Show an indeterminate timer icon in the header when the table is sorted or filtered. Please note that due to javascript processing, the icon may not show as being animated. I'm looking into this further and would appreciate any feedback or suggestions with the coding. New! v2.4. + Show an indeterminate timer icon in the header when the table is sorted or filtered. Please note that due to javascript processing, the icon may not show as being animated. I'm looking into this further and would appreciate any feedback or suggestions with the coding (v2.4). Example @@ -1100,7 +1102,7 @@ From the example function above, you'll end up with something similar to this HT theme String "default" - This option will add a theme css class name to the table "tablesorter-{theme}" for styling. New v2.4. + This option will add a theme css class name to the table "tablesorter-{theme}" for styling (v2.4).

    When changing this theme option, make sure that the appropriate css theme file has also been loaded. Included theme files include: see all themes
    @@ -1212,7 +1214,7 @@ $(function(){ Boolean false - Indicates if tablesorter should apply fixed percentage-based widths to the table columns. Modified! v2.4. + Indicates if tablesorter should apply fixed percentage-based widths to the table columns (modified v2.4).
    Prior to v2.4, this option set pixel widths to added colgroups to fix the column widths. This is useful for the Pager companion.
    @@ -1463,7 +1465,7 @@ $(function(){ Array true - Columns widget: If true, the class names from the columns option will also be added to the table thead. New! v2.4. + Columns widget: If true, the class names from the columns option will also be added to the table thead (v2.4).

    Use the "columns_thead" option to add the column class names to the thead as follows: @@ -1484,7 +1486,7 @@ $(function(){ Array true - Columns widget: If true, the class names from the columns option will also be added to the table tfoot. New! v2.4. + Columns widget: If true, the class names from the columns option will also be added to the table tfoot (v2.4).

    Use the "columns_tfoot" option to add the column class names to the tfoot as follows: @@ -1527,7 +1529,7 @@ $(function(){ Boolean true - Filter widget: If true, a filter will be added to the top of each table column. New! v2.4. + Filter widget: If true, a filter will be added to the top of each table column (v2.4).

    Use the filter_columnFilters option as follows: @@ -1677,7 +1679,7 @@ $(function(){ Boolean false - Filter widget: Set this option to true to hide the filter row initially. The rows is revealed by hovering over the filter row or giving any filter input/select focus. New! v2.4. + Filter widget: Set this option to true to hide the filter row initially. The rows is revealed by hovering over the filter row or giving any filter input/select focus (v2.4).

    Use the filter_hideFilters option as follows: @@ -1760,7 +1762,7 @@ $(function(){ String null - Filter widget: jQuery selector string of an element used to reset the filters. New! v2.4. + Filter widget: jQuery selector string of an element used to reset the filters (v2.4).

    To use this option, point to a reset button or link using a jQuery selector. For example, add this button (<button class="reset">Reset</button>) to the table header, or anywhere else on the page. That element will be used as a reset for all column and quick search filters (clears all fields): @@ -1817,7 +1819,7 @@ $('table').trigger('search', false);

    Boolean false - Filter widget: Set this option to true if filtering is performed on the server-side. New! v2.5.3. + Filter widget: Set this option to true if filtering is performed on the server-side (v2.5.3).

    Use the filter_serversideFiltering option as follows: @@ -1859,7 +1861,7 @@ $('table').trigger('search', false);
    Boolean false - Filter widget: If true, ALL filter searches will only use parsed data. New! v2.4. + Filter widget: If true, ALL filter searches will only use parsed data (v2.4).

    Use the filter_useParsedData option as follows: @@ -1914,7 +1916,7 @@ $('table').trigger('search', false);
    Boolean true - Resizable widget: If this option is set to false, resized column widths will not be saved. Previous saved values will be restored on page reload. New! v2.4. + Resizable widget: If this option is set to false, resized column widths will not be saved. Previous saved values will be restored on page reload (v2.4).

    Use the "resizable" option to change the css class name as follows: @@ -1936,7 +1938,7 @@ $('table').trigger('search', false);
    Boolean true - saveSort widget: If this option is set to false, new sorts will not be saved. Any previous saved sort will be restored on page reload. New! v2.4. + saveSort widget: If this option is set to false, new sorts will not be saved. Any previous saved sort will be restored on page reload (v2.4).

    Use the "saveSort" option to change the css class name as follows: @@ -1958,26 +1960,26 @@ $('table').trigger('search', false);
    String "jui" - ** Updated! in tablesorter v2.4 **
    - - Instead of the array of icon class names, this option now contains the name of the theme. Currently jQuery UI ("jui") and Bootstrap ("bootstrap") themes are supported. To modify the class names used, extend from the theme + Instead of the array of icon class names, this option now contains the name of the theme. Currently jQuery UI ("jui") and Bootstrap ("bootstrap") themes are supported. To modify the class names used, extend from the theme (updated v2.4)

    // Extend the themes to change any of the default class names ** NEW **
     $.extend($.tablesorter.themes.jui, {
       // change default jQuery uitheme icons - find the full list of icons
       // here: http://jqueryui.com/themeroller/ (hover over them for their name)
    -  table    : 'ui-widget ui-widget-content ui-corner-all', // table classes
    -  header   : 'ui-widget-header ui-corner-all ui-state-default', // header classes
    -  icons    : 'ui-icon', // icon class added to the <i> in the header
    -  sortNone : 'ui-icon-carat-2-n-s',
    -  sortAsc  : 'ui-icon-carat-1-n',
    -  sortDesc : 'ui-icon-carat-1-s',
    -  active   : 'ui-state-active', // applied when column is sorted
    -  hover    : 'ui-state-hover',  // hover class
    -  filterRow: '',
    -  even     : 'ui-widget-content', // even row zebra striping
    -  odd      : 'ui-state-default'   // odd row zebra striping
    +  table      : 'ui-widget ui-widget-content ui-corner-all', // table classes
    +  header     : 'ui-widget-header ui-corner-all ui-state-default', // header classes
    +  footerRow  : '',
    +  footerCells: '',
    +  icons      : 'ui-icon', // icon class added to the <i> in the header
    +  sortNone   : 'ui-icon-carat-2-n-s',
    +  sortAsc    : 'ui-icon-carat-1-n',
    +  sortDesc   : 'ui-icon-carat-1-s',
    +  active     : 'ui-state-active', // applied when column is sorted
    +  hover      : 'ui-state-hover',  // hover class
    +  filterRow  : '',
    +  even       : 'ui-widget-content', // even row zebra striping
    +  odd        : 'ui-state-default'   // odd row zebra striping
     });
    This widget option replaces the previous widgetUitheme. All theme css names are now contained within the $.tablesorter.themes variable. Extend the default theme as seen above.
    @@ -1991,26 +1993,29 @@ $.extend($.tablesorter.themes.jui, { Use the "uitheme" option to change the css class name as follows:
    $(function(){
       $("table").tablesorter({
    -    widgets: ["uitheme"], // initialize ui theme styling widget of the table
    +    theme     : 'jui',       // set theme name from $.tablesorter.themes here
    +    widgets   : ["uitheme"], // initialize ui theme styling widget of the table
         widgetOptions: {
    -      uitheme : "jui"
    +      uitheme : "jui"        // this is now optional in v2.7, it is overridden by the theme option 
         }
       });
     });
    To add a new theme, define it as follows; replace "custom" with the name of your theme:
    $.tablesorter.themes.custom = {
    -  table    : 'table',       // table classes
    -  header   : 'header',      // header classes
    -  icons    : 'icon',        // icon class added to the <i> in the header
    -  sortNone : 'sort-none',   // unsorted header
    -  sortAsc  : 'sort-asc',    // ascending sorted header
    -  sortDesc : 'sort-desc',   // descending sorted header
    -  active   : 'sort-active', // applied when column is sorted
    -  hover    : 'hover',       // hover class
    -  filterRow: 'filters',     // class added to the filter row
    -  even     : 'even',        // even row zebra striping
    -  odd      : 'odd'          // odd row zebra striping
    +  table      : 'table',       // table classes
    +  header     : 'header',      // header classes
    +  footerRow  : '',
    +  footerCells: '',
    +  icons      : 'icon',        // icon class added to the <i> in the header
    +  sortNone   : 'sort-none',   // unsorted header
    +  sortAsc    : 'sort-asc',    // ascending sorted header
    +  sortDesc   : 'sort-desc',   // descending sorted header
    +  active     : 'sort-active', // applied when column is sorted
    +  hover      : 'hover',       // hover class
    +  filterRow  : 'filters',     // class added to the filter row
    +  even       : 'even',        // even row zebra striping
    +  odd        : 'odd'          // odd row zebra striping
     }
    Example diff --git a/docs/themes.html b/docs/themes.html index 952f5c75..9d145a5c 100644 --- a/docs/themes.html +++ b/docs/themes.html @@ -6,7 +6,7 @@