2013-02-17 19:53:33 +00:00
<!DOCTYPE html>
2011-07-27 06:14:20 +00:00
< html >
< head >
< meta charset = "utf-8" >
2016-01-10 22:24:57 +00:00
< title > jQuery tablesorter 2.0 - jQuery UITheme Widget (jQuery UI)< / title >
2011-07-27 06:14:20 +00:00
<!-- jQuery -->
2014-05-21 22:09:23 +00:00
< script src = "js/jquery-latest.min.js" > < / script >
2011-07-27 06:14:20 +00:00
<!-- Demo stuff -->
< link rel = "stylesheet" href = "css/jq.css" >
2013-01-26 15:21:13 +00:00
< link href = "css/prettify.css" rel = "stylesheet" >
< script src = "js/prettify.js" > < / script >
2011-07-27 06:14:20 +00:00
< script src = "js/docs.js" > < / script >
2013-11-08 08:43:57 +00:00
<!-- jQuery UI theme switcher: https://github.com/pontikis/jui_theme_switch/ -->
< style >
.switcher_container { padding: 5px; }
.switcher_list { padding: 2px; }
.switcher_label { margin-right: 5px; }
< / style >
< script src = "js/jquery.jui_theme_switch.min.js" > < / script >
2011-07-27 06:14:20 +00:00
<!-- Tablesorter: required; also include any of the jQuery UI themes -->
2014-05-21 22:09:23 +00:00
< link id = "ui-theme" rel = "stylesheet" href = "css/jquery-ui.min.css" >
2013-11-08 08:43:57 +00:00
< link href = "../css/theme.jui.css" rel = "stylesheet" >
2015-01-25 18:11:54 +00:00
< link href = "../css/theme.grey.css" rel = "stylesheet" >
2012-01-22 15:02:02 +00:00
2011-07-27 06:14:20 +00:00
< script src = "../js/jquery.tablesorter.js" > < / script >
2016-07-08 16:17:28 +00:00
< script src = "../js/widgets/widget-filter.js" > < / script >
< script src = "../js/widgets/widget-uitheme.js" > < / script >
2011-07-27 06:14:20 +00:00
<!-- Tablesorter: optional -->
2011-09-11 17:51:02 +00:00
<!-- <script src="../addons/pager/jquery.tablesorter.pager.js"></script> -->
2011-07-27 06:14:20 +00:00
< script id = "js" > $ ( f u n c t i o n ( ) {
2015-01-15 20:06:01 +00:00
// Extend the themes to change any of the default class names
2012-09-27 19:57:19 +00:00
$.extend($.tablesorter.themes.jui, {
2015-01-15 20:06:01 +00:00
// change default jQuery uitheme icons - find the full list of icons at
// http://jqueryui.com/themeroller/ (hover over them for their name)
table : 'ui-widget ui-widget-content ui-corner-all', // table classes
caption : 'ui-widget-content',
// header class names
header : 'ui-widget-header ui-corner-all ui-state-default', // header classes
sortNone : '',
sortAsc : '',
sortDesc : '',
active : 'ui-state-active', // applied when column is sorted
hover : 'ui-state-hover', // hover class
// icon class names
icons : 'ui-icon', // icon class added to the < i > in the header
iconSortNone : 'ui-icon-carat-2-n-s', // class name added to icon when column is not sorted
iconSortAsc : 'ui-icon-carat-1-n', // class name added to icon when column has ascending sort
iconSortDesc : 'ui-icon-carat-1-s', // class name added to icon when column has descending sort
filterRow : '',
footerRow : '',
footerCells : '',
even : 'ui-widget-content', // even row zebra striping
odd : 'ui-state-default' // odd row zebra striping
2012-09-27 19:57:19 +00:00
});
2011-07-27 06:14:20 +00:00
// call the tablesorter plugin and apply the ui theme widget
$("table").tablesorter({
2011-09-16 15:43:09 +00:00
2013-01-29 22:42:23 +00:00
theme : 'jui', // theme "jui" and "bootstrap" override the uitheme widget option in v2.7+
2012-12-26 08:06:26 +00:00
headerTemplate : '{content} {icon}', // needed to add icon for jui theme
2011-09-11 17:51:02 +00:00
// widget code now contained in the jquery.tablesorter.widgets.js file
2016-07-08 16:17:28 +00:00
widgets : ['uitheme', 'filter', 'zebra'],
2011-09-16 15:43:09 +00:00
2012-03-07 18:06:35 +00:00
widgetOptions : {
2012-09-27 19:57:19 +00:00
// zebra striping class names - the uitheme widget adds the class names defined in
// $.tablesorter.themes to the zebra widget class names
zebra : ["even", "odd"],
2011-09-16 15:43:09 +00:00
2013-01-29 22:42:23 +00:00
// 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'
2012-03-07 18:06:35 +00:00
}
2012-09-27 19:57:19 +00:00
2011-07-27 06:14:20 +00:00
});
2011-09-11 17:51:02 +00:00
2011-07-27 06:14:20 +00:00
});< / script >
2013-11-08 08:43:57 +00:00
< script >
$(function(){
$('#switcher').jui_theme_switch({
stylesheet_link_id : 'ui-theme',
datasource_url : 'assets/theme_switcher.json'
});
});
< / script >
2011-07-27 06:14:20 +00:00
< / head >
< body >
< div id = "banner" >
< h1 > table< em > sorter< / em > < / h1 >
2012-09-27 19:57:19 +00:00
< h2 > jQuery UITheme Widget (jQuery UI)< / h2 >
2011-07-27 06:14:20 +00:00
< h3 > Flexible client-side table sorting< / h3 >
< a href = "index.html" > Back to documentation< / a >
< / div >
< div id = "main" >
2011-09-08 16:28:10 +00:00
< p class = "tip" >
2012-03-07 18:06:35 +00:00
< em > NOTE!< / em >
2016-01-10 22:24:57 +00:00
< / p >
< ul >
< li > In < span class = "version" > v2.19.0< / span > , this widget allows dynamic changing of themes; including switching from jQuery UI or Bootstrap to any other theme. To change a theme, do the following:
< pre class = "prettyprint lang-js" > var $table = $('table');
2015-01-14 17:20:36 +00:00
$table[0].config.theme = 'grey';
$table.trigger('applyWidgets');< / pre >
2016-01-10 22:24:57 +00:00
To see this work, check out the < a href = "example-widget-scroller.html" > scroller widget demo< / a > .
< / li >
< li > As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8.< / li >
< li > You will need to modify the < code > headerTemplate< / code > option to include the bootstrap icon! See the example in the code (v2.7).< / li >
< li > The original "widgetUitheme" option has been replaced by "widgetOptions.uitheme". See the javascript block below for more details (v2.1).< / li >
< li > In tablesorter v2.4, the < code > uitheme< / code > option has changed to indicate the theme instead of an array of icons to use:
< ul >
< li > All theme class names are now contained within < code > $.tablesorter.themes< / code > with the jQuery UI theme saved to < code > $.tablesorter.themes.jui< / code > < / li >
< li > 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.< / li >
< li > Set the < code > uitheme< / code > widget option to < code > "jui"< / code > to set the widget to use the jQuery UI theme. See the < a href = "example-widget-bootstrap-theme.html" > bootstrap demo< / a > for another example.< / li >
< / ul >
< / li >
< li > Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4+ requires jQuery 1.2.6+.< / li >
< / ul >
2011-09-08 16:28:10 +00:00
2011-07-27 06:14:20 +00:00
< h1 > Demo< / h1 >
2012-09-27 19:57:19 +00:00
< br >
2012-01-22 15:02:02 +00:00
jQuery UI Theme:
< div id = "switcher" > < / div >
< br >
2011-07-27 06:14:20 +00:00
< div id = "demo" > < table class = "tablesorter" >
2013-11-09 05:14:23 +00:00
< caption > Some interesting caption< / caption >
2011-07-27 06:14:20 +00:00
< thead >
< tr >
< th > First Name< / th >
< th > Last Name< / th >
< th > Age< / th >
< th > Total< / th >
< th > Discount< / th >
< th > Date< / th >
< / tr >
< / thead >
2012-09-27 19:57:19 +00:00
< tfoot >
< tr >
< th > First Name< / th >
< th > Last Name< / th >
< th > Age< / th >
< th > Total< / th >
< th > Discount< / th >
< th > Date< / th >
< / tr >
< / tfoot >
2011-07-27 06:14:20 +00:00
< 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 >
2011-09-11 17:51:02 +00:00
< h1 > Page Header< / h1 >
< div >
2013-01-26 15:21:13 +00:00
< pre class = "prettyprint lang-html" > < !-- ui theme stylesheet - contents shown below -->
2012-09-27 19:57:19 +00:00
< link rel=" stylesheet" href=" ../css/theme.jui.css" >
2011-09-11 17:51:02 +00:00
< !-- jQuery UI theme (cupertino example here) -->
2014-05-21 22:09:23 +00:00
< link rel=" stylesheet" href=" css/jquery-ui.min.css" >
2011-09-11 17:51:02 +00:00
< !-- tablesorter plugin -->
< script src=" ../js/jquery.tablesorter.js" > < /script>
< !-- tablesorter widget file - loaded after the plugin -->
< script src=" ../js/jquery.tablesorter.widgets.js" > < /script> < / pre >
< / div >
2011-07-27 06:14:20 +00:00
< h1 > Javascript< / h1 >
< div id = "javascript" >
2013-01-26 15:21:13 +00:00
< pre class = "prettyprint lang-javascript" > < / pre >
2011-07-27 06:14:20 +00:00
< / div >
< h1 > HTML< / h1 >
< div id = "html" >
2013-01-26 15:21:13 +00:00
< pre class = "prettyprint lang-html" > < / pre >
2011-07-27 06:14:20 +00:00
< / div >
< div class = "next-up" >
< hr / >
2012-12-22 16:02:03 +00:00
Next up: < a href = "example-widget-bootstrap-theme.html" > UITheme widget - Bootstrap theme › › < / a > < br >
Second time around: < a href = "example-option-render-header.html" > Modifying the Header during rendering › › < / a >
2011-07-27 06:14:20 +00:00
< / div >
< / div >
< / body >
< / html >