From 3851ea9cbcac26fc564df50c4f01580141fc7345 Mon Sep 17 00:00:00 2001 From: Mottie Date: Mon, 7 Jan 2013 09:57:36 -0600 Subject: [PATCH] updated bootstrap demo - issue #111 --- README.md | 7 ++++ docs/example-widget-bootstrap-theme.html | 43 ++++++++++++------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index fcbb98cfc..4ab529c63 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,13 @@ 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.1b (1/7/2013) + +* Updated bootstrap demo + * It now properly removes the "table-striped" class when the zebra widget is enabled. + * The demo now uses the [`refreshWidgets` method](http://mottie.github.com/tablesorter/docs/index.html#refreshwidgets) (added in v2.4) to completely remove the zebra widget. + * Thanks to [potsky](https://github.com/Mottie/tablesorter/issues/111#issuecomment-11951369) for notifying me of this problem! + #### Version 2.7.1 (1/4/2013) * Added two internal parameters to always make sure we're targeting the correct elements. diff --git a/docs/example-widget-bootstrap-theme.html b/docs/example-widget-bootstrap-theme.html index d4d98c947..774768686 100644 --- a/docs/example-widget-bootstrap-theme.html +++ b/docs/example-widget-bootstrap-theme.html @@ -28,7 +28,7 @@ $.extend($.tablesorter.themes.bootstrap, { // these classes are added to the table. To see other table classes available, // look here: http://twitter.github.com/bootstrap/base-css.html#tables - table : 'table table-bordered table-striped', + table : 'table table-bordered', header : 'bootstrap-header', // give the header a gradient background footerRow : '', footerCells: '', @@ -46,7 +46,7 @@ // call the tablesorter plugin and apply the uitheme widget $("table").tablesorter({ theme : "bootstrap", // this will - +debug: true, widthFixed: true, headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon! @@ -97,31 +97,26 @@ txt = $(this).data('filter'); $('table').find('.tablesorter-filter').val('').eq(col).val(txt); $('table').trigger('search', false); - - // the commented out code below will filter the rows - // without adding text to the filter input - // ****************** - // var filter = []; - // filter[col] = txt; // get text to filter - // $('table').trigger('search', [filter]); }); // toggle zebra widget $('button.zebra').click(function(){ - var t = $(this).find('i').hasClass('icon-ok'); - if (t) { + var t = $(this).hasClass('btn-success'); +// if (t) { // removing classes applied by the zebra widget // you shouldn't ever need to use this code, it is only for this demo - $('table').find('tr').removeClass('odd even'); - } - $('table')[0].config.widgets = (t) ? ["uitheme", "filter"] : ["uitheme", "filter", "zebra"]; +// $('table').find('tr').removeClass('odd even'); +// } + $('table') + .toggleClass('table-striped')[0] + .config.widgets = (t) ? ["uitheme", "filter"] : ["uitheme", "filter", "zebra"]; $(this) .toggleClass('btn-danger btn-success') .find('i') .toggleClass('icon-ok icon-remove').end() .find('span') .text(t ? 'disabled' : 'enabled'); - $('table').trigger('applyWidgets'); + $('table').trigger('refreshWidgets', [false]); }); }); @@ -142,21 +137,25 @@

Flexible client-side table sorting

NOTE!