-
Notifications
You must be signed in to change notification settings - Fork 754
Customize
Wiki: Home | FAQ | Customize | Snippets | Search | Language | Changes | Change summary
- A
dist
folder is dynamically created and updated with.min.js
and.min.css
versions of all the files. - The
jquery.tablesorter.js
file is copied as-is from the source directory. - A custom
jquery.tablesorter.widgets.js
file is created using npm & grunt; this file also includes a compressed version. - If you need a source (uncompressed/developement) version of the file, look in the
js/
,css/
oraddons/
folders.
- Install Node.js - it includes
npm
(node package manager). - Open a command window in the tablesorter root directory.
- Enter
npm install
to load all the necessary dependencies into thenode_modules
folder; this includes grunt. - Enter
npm install -g grunt-cli
to install the grunt command-line-interface globablly. - Now you are ready to run grunt!
-
A standard build includes the following widgets:
-
storage
- local storage of specific widget settings with a cookie fallback. -
uitheme
- Enhancements to add Bootstrap & jQuery UI themes to tablesorter. -
columns
- Column highlighting of sorted columns. -
filter
- Filter rows -
stickyHeaders
- make the header stick to the top of the page while scrolling. -
resizable
- make columns resizable. -
saveSort
- Use the storage widget to save the last sort.
-
-
To create a
jquery.tablesorter.widgets.js
(and compressed file) with the standard widgets, enter:grunt
- To get a custom build, you'll need to create a json file in the root directory, with a list of the widgets to include.
- Name the file anything you want but do not include any spaces.
- An
example.json
file has been included in the root directory for reference, but don't modify it because it will get updated with the repository.
The contents of the json file will look like this:
{
"widgets" : "filter stickyHeaders uitheme",
"includeDependencies" : false
}
-
widgets
option:- The
widgets
option will be a list of widget names taken from the file name between the "widget-" and the ".js" (widget-{name}.js
), e.g. use "filter-formatter-jui" for the jQuery UI specific filter formatter file named "widget-filter-formatter-jui.js". - For ease of entry, this value is a string of space separated widget names, extra spaces will be ignored.
- The
-
includeDependencies
option:- This option adds any widget dependencies to the custom widget file during the build when set to
true
. - For example, several widgets need the storage widget to save data, so if you include the "saveSort" widget, the "storage" widget will automatically be included when this option is
true
. - Another example is if you include the "filter-formatter-jui" widget, it will automatically include the "filter" widget.
- Setting this option to
false
will flag the build to not include dependencies within thejquery.tablesorter.widgets.js
file; just be aware that the included widgets might still need that dependency. - Not setting or including this option will make it default to
true
.
- This option adds any widget dependencies to the custom widget file during the build when set to
- To use the custom options:
-
Run
grunt custom:{file-name}
to create the custom file. -
This example shows how to use the included
example.json
set up.grunt custom:example.json
-
-
The following command will perform jshint & qunit tests on the files
grunt test
-
Please note that several of the asynchronous qunit tests are fickle (or maybe poorly written by me) and require re-running the test before they work properly.
- The following changes to files have been made (this might break a few jsFiddle demos):
-
jquery.metadata.js
has been moved into thejs/extras
folder. -
jquery.tablesorter.widgets-filter-formatter.js
- moved to the
js/widgets
folder - Broken into two files, and renamed to
widget-filter-formatter-html5.js
andwidget-filter-formatter-jui.js
.
- moved to the
-
jquery.tablesorter.widgets-filter-formatter-select2.js
- Moved into the
js/widgets
folder. - Renamed to
widget-filter-formatter-select2.js
- Moved into the
-
jquery.tablesorter.widgets.js
- Has been broken up into separate widget files:
widget-column.js
,widget-filter.js
,widget-resizable.js
,widget-saveSort.js
,widget-stickyHeaders.js
,widget-storage.js
andwidget-uitheme.js
. - A default build creates a file of the above widgets combined in the
dist/js
folder. - A copy of this newly created combined widget file is then copied back to the
js/
folder to allow external demos (jsFiddle) to still work.
- Has been broken up into separate widget files:
-
Wiki: Home | FAQ | Customize | Snippets | Search | Language | Changes | Older-changes-2.25.0 | Older-changes-2.13.0 | Change summary