-
Notifications
You must be signed in to change notification settings - Fork 749
Customize
Rob Garrison edited this page May 17, 2018
·
6 revisions
Wiki: Home | FAQ | Customize | Snippets | Search | Language | Changes | Older-changes-2.25.0 | Older-changes-2.13.0 | Change summary
- A
distfolder is dynamically created and updated with.min.jsand.min.cssversions of all the files. - The
jquery.tablesorter.jsfile is copied as-is from the source directory. - A custom
jquery.tablesorter.widgets.jsfile is created using npm & grunt; this file also includes a compressed version. - This custom file places all included widgets within a UMD (Universal Module Definition) wrapper, for RequireJS, AMD & CommonJS compatibility.
- 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 installto load all the necessary dependencies into thenode_modulesfolder; this includes grunt. - Enter
npm install -g grunt-clito 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.jsonfile 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 may look like this (example.json contents are shown):
{
"widgets" : "filter stickyHeaders uitheme",
"parsers" : "ignore-articles network",
"includeDependencies" : false,
"destFileName" : "jquery.tablesorter.custom-widgets.js"
}-
widgetsoption:- The
widgetsoption 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.
- If no widgets names are included in the custom options, the build will
abort(changed v2.21.4) continue with the default widgets.
- The
-
parsersoption (added v2.21.4):- The
parsersoption will be a list of parser names taken from the file name between the "parser-" and the ".js" (parser-{name}.js), e.g. use "input-select" for the parser set up to obtain the values from inputs, textarea, checkboxes or select (text or value) elements named "parser-input-select.js". - For ease of entry, this value is a string of space separated parser names, extra spaces will be ignored.
- If no parsers are included in this option, the custom build will continue without any parsers.
- The
-
includeDependenciesoption:- 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
falsewill flag the build to not include dependencies within thejquery.tablesorter.widgets.jsfile; 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
-
destFileNameoption:- Set to add a destination file name for the custom widgets.
- If no file name is provided, the file name will default to "jquery.tablesorter.custom-widgets.js".
- This file will be created in the
dist/jsfolder, along with a.minversion; and a copy will be made in thejs/folder.
- To use the custom options:
-
Run
grunt custom:{file-name}to create the custom file. -
This example shows how to use the included
example.jsonset up.grunt custom:example.json
-
-
jquery.tablesorter.jsis copied to thedist/jsfolder. - All
lessfiles are copied to thedist/css/lessfolder. - All images, including the pager icons, is copied into the
dist/css/imagesfolder. - A combined widget file is created:
- For a standard build, a
jquery.tablesorter.widgets.jsfile is created in thedist/jsfolder. - Custom builds will create a
jquery.tablesorter.custom-widgets.jsfile (or customized name from the settings) of the selected widgets in thedist/jsfolder. - This file is then copied back to the
jsfolder.
- For a standard build, a
- A combined tablesorter file is created:
- For a standard build, a
jquery.tablesorter.combined.jsfile is created in thedist/jsfolder. - A custom build will also create the same named file, but include all selected widgets & parsers all wrapped to work as a UMD module.
- This file is then copied back to the
jsfolder.
- For a standard build, a
- A
.min.jsfile is created for the core, widget and combined files in thedist/jsfolder, then all parsers & widgets are compressed separately in thedist/js/parsersanddist/js/widgetsfolder, respectively. - A
.min.cssfile is created for all themes, dragtable, filter-formatter & pager styles. - The version number of the core and minified core is updated to match the
package.jsonvalue. - The black-ice theme within the distribution folder is renamed to
theme.blackice.min.css(no dash). See issue #785.
-
The following command will perform jshint & qunit tests on the files
grunt test
- The following changes to files have been made (this might break a few jsFiddle demos):
-
jquery.metadata.jshas been moved into thejs/extrasfolder. -
jquery.tablesorter.widgets-filter-formatter.js- moved to the
js/widgetsfolder - Broken into two files, and renamed to
widget-filter-formatter-html5.jsandwidget-filter-formatter-jui.js.
- moved to the
-
jquery.tablesorter.widgets-filter-formatter-select2.js- Moved into the
js/widgetsfolder. - 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.jsandwidget-uitheme.js. - A standard build creates a file of the above widgets combined in the
dist/jsfolder. - 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:
-
- v2.21.3: Added
destFileNameoption within the build json file. This allows naming the custom widget build file. - v2.21.4: Added
parsersoption to build json file; Build now includes a combined file containing the core plugin and all selected widgets & parsers.
Wiki: Home | FAQ | Customize | Snippets | Search | Language | Changes | Older-changes-2.25.0 | Older-changes-2.13.0 | Change summary