├── .github
└── FUNDING.yml
├── Issue_template.txt
├── License.txt
├── Readme.md
├── bower.json
├── css
├── colReorder.bootstrap.scss
├── colReorder.bootstrap4.scss
├── colReorder.bootstrap5.scss
├── colReorder.bulma.scss
├── colReorder.dataTables.scss
├── colReorder.foundation.scss
├── colReorder.jqueryui.scss
└── colReorder.semanticui.scss
├── docs
├── api
│ ├── colReorder.disable().xml
│ ├── colReorder.enable().xml
│ ├── colReorder.move().xml
│ ├── colReorder.order().xml
│ ├── colReorder.reset().xml
│ └── colReorder.transpose().xml
├── event
│ ├── column-reorder.xml
│ └── columns-reordered.xml
└── option
│ ├── colReorder.columns.xml
│ ├── colReorder.enable.xml
│ ├── colReorder.headerRows.xml
│ ├── colReorder.order.xml
│ └── colReorder.xml
├── examples
├── index.xml
├── initialisation
│ ├── col_filter.xml
│ ├── column-selector.xml
│ ├── complex-header-row.xml
│ ├── complex-header.xml
│ ├── enableDisable.xml
│ ├── footer_callback.xml
│ ├── index.xml
│ ├── new_init.xml
│ ├── orthogonal-data-attrs.xml
│ ├── predefined.xml
│ ├── reset.xml
│ ├── scrolling.xml
│ └── simple.xml
├── integration
│ ├── colvis.xml
│ ├── fixedcolumns.xml
│ ├── fixedheader.xml
│ ├── index.xml
│ ├── responsive.xml
│ ├── server_side.xml
│ └── state_save.xml
└── styling
│ ├── bootstrap.xml
│ ├── bootstrap4.xml
│ ├── bootstrap5.xml
│ ├── bulma.xml
│ ├── foundation.xml
│ ├── index.xml
│ ├── jqueryui.xml
│ └── semanticui.xml
├── js
├── ColReorder.ts
├── colReorder.bootstrap.js
├── colReorder.bootstrap4.js
├── colReorder.bootstrap5.js
├── colReorder.bulma.js
├── colReorder.dataTables.js
├── colReorder.foundation.js
├── colReorder.jqueryui.js
├── colReorder.semanticui.js
├── dataTables.colReorder.ts
└── functions.ts
├── make.sh
├── rollup.config.mjs
├── test
├── api
│ ├── move().js
│ ├── order().js
│ ├── reset().js
│ └── transpose().js
├── events
│ ├── column-reorder.js
│ └── columns-reordered.js
└── options
│ ├── enable.js
│ └── order.js
├── tsconfig.json
└── types
├── colReorder.bootstrap.d.ts
├── colReorder.bootstrap4.d.ts
├── colReorder.bootstrap5.d.ts
├── colReorder.bulma.d.ts
├── colReorder.dataTables.d.ts
├── colReorder.foundation.d.ts
├── colReorder.jqueryui.d.ts
├── colReorder.semanticui.d.ts
└── types.d.ts
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataTables/ColReorder/6a9a178d713c0d7d3379651ce622900527dc4e35/.github/FUNDING.yml
--------------------------------------------------------------------------------
/Issue_template.txt:
--------------------------------------------------------------------------------
1 | Please post support requests and questions in the DataTables forums at https://datatables.net/forums. Support requests posted here will be closed. The intention of this request is to allow all questions to be located in a single, searchable, location.
2 |
3 | When you post your question in the DataTables forums, please ensure that you include a link to the page showing the issue so it can be debugged.
4 |
--------------------------------------------------------------------------------
/License.txt:
--------------------------------------------------------------------------------
1 | MIT license
2 |
3 | Copyright (c) 2010-2015 SpryMedia Limited
4 | http://datatables.net
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # ColReorder
2 |
3 | ColReorder adds the ability for the end user to click and drag column headers to reorder a table as they see fit, to DataTables. See the [documentation](http://datatables.net/extensions/colreorder/) for full details.
4 |
5 |
6 | # Installation
7 |
8 | To use ColReorder the primary way to obtain the software is to use the [DataTables downloader](//datatables.net/download). You can also include the individual files from the [DataTables CDN](//cdn.datatables.net). See the [documentation](http://datatables.net/extensions/colreorder/) for full details.
9 |
10 | ## NPM and Bower
11 |
12 | If you prefer to use a package manager such as NPM or Bower, distribution repositories are available with software built from this repository under the name `datatables.net-colreorder`. Styling packages for Bootstrap, Foundation and other styling libraries are also available by adding a suffix to the package name.
13 |
14 | Please see the DataTables [NPM](//datatables.net/download/npm) and [Bower](//datatables.net/download/bower) installation pages for further information. The [DataTables installation manual](//datatables.net/manual/installation) also has details on how to use package managers with DataTables.
15 |
16 |
17 | # Basic usage
18 |
19 | ColReorder is initialised using the `colReorder` option in the DataTables constructor - a simple boolean `true` will enable the feature. Further options can be specified using this option as an object - see the documentation for details.
20 |
21 | Example:
22 |
23 | ```js
24 | $(document).ready( function () {
25 | $('#myTable').DataTable( {
26 | colReorder: true
27 | } );
28 | } );
29 | ```
30 |
31 |
32 | # Documentation / support
33 |
34 | * [Documentation](https://datatables.net/extensions/colreorder/)
35 | * [DataTables support forums](http://datatables.net/forums)
36 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "datatables-colreorder",
3 | "main": [
4 | "js/dataTables.colReorder.js",
5 | "css/colReorder.dataTables.scss"
6 | ],
7 | "dependencies": {
8 | "jquery": ">=1.7.0",
9 | "datatables": ">=1.10.8"
10 | },
11 | "license": "MIT"
12 | }
13 |
--------------------------------------------------------------------------------
/css/colReorder.bootstrap.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #337ab7 !default;
3 |
4 | @import 'colReorder.dataTables.scss';
5 |
--------------------------------------------------------------------------------
/css/colReorder.bootstrap4.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #0275d8 !default;
3 |
4 | @import 'colReorder.dataTables.scss';
5 |
--------------------------------------------------------------------------------
/css/colReorder.bootstrap5.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #0d6efd !default;
3 | $colreorder-insert-color-dark: rgb(13, 110, 253) !default;
4 |
5 | @import 'colReorder.dataTables.scss';
6 |
--------------------------------------------------------------------------------
/css/colReorder.bulma.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #00D1B2 !default;
3 |
4 | @import 'colReorder.dataTables.scss';
5 |
--------------------------------------------------------------------------------
/css/colReorder.dataTables.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #0259C4 !default;
3 | $colreorder-insert-color-dark: rgb(110, 168, 254) !default;
4 |
5 | body.dtcr-dragging {
6 | overflow-x: hidden;
7 | }
8 |
9 | // Floating table, dragged with the mouse
10 | table.dtcr-cloned.dataTable {
11 | position: absolute !important;
12 | background-color: rgba(255, 255, 255, 0.7);
13 | z-index: 202;
14 | border-radius: 4px;
15 | }
16 |
17 | table.dataTable tbody {
18 | tr {
19 | td.dtcr-moving {
20 | background-color: rgba(127, 127, 127, 0.15);
21 | }
22 |
23 | td.dtcr-moving-first {
24 | border-left: 1px solid $colreorder-insert-color;
25 | }
26 |
27 | td.dtcr-moving-last {
28 | border-right: 1px solid $colreorder-insert-color;
29 | }
30 | }
31 | }
32 |
33 | html.dark {
34 | table.dtcr-cloned.dataTable {
35 | background-color: rgba(33, 33, 33, 0.9);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/css/colReorder.foundation.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #008CBA !default;
3 |
4 | @import 'colReorder.dataTables.scss';
5 |
--------------------------------------------------------------------------------
/css/colReorder.jqueryui.scss:
--------------------------------------------------------------------------------
1 |
2 | @import 'colReorder.dataTables.scss';
3 |
--------------------------------------------------------------------------------
/css/colReorder.semanticui.scss:
--------------------------------------------------------------------------------
1 |
2 | $colreorder-insert-color: #888 !default;
3 |
4 | @import 'colReorder.dataTables.scss';
5 |
--------------------------------------------------------------------------------
/docs/api/colReorder.disable().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.disable()
4 | Disable ColReorder's interactions
5 | 1.5.0
6 |
7 |
8 | colReorder.disable()
9 | colReorder.disable()
10 |
11 | Disable end user ability to reorder columns.
12 |
13 | DataTables API instance
14 |
15 |
16 |
17 | This method can be used to disable the ColReorder end user interaction with a DataTable.
18 |
19 | Please note that in order to be able to enable and disable ColReorder, the `-init colReorder` option _must_ be specified in the DataTable initialisation. This method cannot be used to control enablement of ColReorder if `-init colReorder` has not be used.
20 |
21 |
22 |
35 |
36 | -init colReorder.enable
37 | -api colReorder.enable()
38 | -api colReorder.disable()
39 |
40 |
--------------------------------------------------------------------------------
/docs/api/colReorder.enable().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.enable()
4 | Enable or disable ColReorder's interactions
5 | 1.5.0
6 |
7 |
8 | colReorder.enable()
9 | colReorder.enable( [ flag ] )
10 |
11 | Enable and disable user ability to reorder columns in a table.
12 |
13 |
14 | This option can be given as the following values:
15 |
16 | * `true` - Enable ColReorder
17 | * `false` - Disable ColReorder
18 |
19 | DataTables API instance
20 |
21 |
22 |
23 | This method can be used to enable and disable the ColReorder end user interaction with a DataTable. In its simplest form it can be used to enable ColReorder, but it can also be used to disable it using the optional parameter. This is useful to be able to toggle the enablement state using a ternary operator or some external variable.
24 |
25 | Please note that in order to be able to enable ColReorder, the `-init colReorder` option _must_ be specified in the DataTable initialisation. This method cannot be used to enable ColReorder if `-init colReorder` has not be used.
26 |
27 |
28 |
41 |
42 | -init colReorder.enable
43 | -api colReorder.enable()
44 | -api colReorder.disable()
45 |
46 |
--------------------------------------------------------------------------------
/docs/api/colReorder.move().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.move()
4 | Programmatically move columns
5 | 1.4.0
6 |
7 |
8 | colReorder.move( from, to [, drop [, invalidate ] ] )
9 |
10 | Programmatically reorder columns
11 |
12 |
13 | Column index to move.
14 |
15 |
16 | New index to move the column to.
17 |
18 |
19 | Indicate that this is the final move. Set this to `false` if you are performing multiple moves.
20 |
21 |
22 | Invalidate the row data. As with `drop` it can be useful to set this to `false` if performing multiple moves. Otherwise allow it to default which will ensure that the table's data is fully insync with the column order.
23 |
24 |
25 | Unmodified API instance.
26 |
27 |
28 |
29 |
30 | This method provides the ability to programmatically change the order of one column at a time (while `-api colReorder.order()` will set the order of all columns together).
31 |
32 |
33 |
40 |
41 |
--------------------------------------------------------------------------------
/docs/api/colReorder.order().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.order()
4 | Get / set column order
5 | 1.2.0
6 |
7 |
8 | colReorder.order()
9 |
10 | Get the current column order.
11 |
12 |
13 | Returns an array of column indexes. The column index given is the original column index, with its new position defined by the location in the returned array.
14 |
15 |
16 |
17 |
18 | colReorder.order( order [, originalIndexes ] )
19 |
20 | Set the column order.
21 |
22 |
23 | Array of column indexes that define where the columns should be placed after the reorder.
24 |
25 | Please note that by default the column indexes given by this array are assumed to be the **current** column indexes, i.e. `0` will always refer to the first column in the table, regardless of the table ordering. The optional second parameter can be used to indicate that they should actually be treated as the original indexes.
26 |
27 |
28 | The order array defines the positions that columns should be shown through column indexes but these indexes can be one of:
29 |
30 | 1. The **current** column index (i.e. even if column reordering has already happened)
31 | 2. The **original** column index (i.e. the original index of the column before ColReorder has done any reordering)
32 |
33 | Set to be `true` to indicate that the indexes passed in are the original indexes. `false` or `undefined` (default) will treat them as the current indexes.
34 |
35 |
36 | DataTables API instance for chaining
37 |
38 |
39 |
40 |
41 | This method provides the ability to get the current column order of a DataTable and also to set a new order.
42 |
43 | The reorder triggered by this method is immediate and there is no requirement to redraw the table.
44 |
45 |
46 |
55 |
56 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/docs/api/colReorder.reset().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.reset()
4 | Restore the loaded column order
5 | 1.2.0
6 |
7 |
8 | colReorder.reset()
9 |
10 | Restore the column order that the columns were in when initially loaded.
11 |
12 | DataTables API instance
13 |
14 |
15 |
16 | This method provides the ability to restore the original order of the columns, as was defined in the HTML during the table's initialisation. This will undo any reordering changes that the end user or the API has made prior to calling this method.
17 |
18 | The reorder triggered by this method is immediate and there is no requirement to redraw the table.
19 |
20 |
21 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/docs/api/colReorder.transpose().xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.transpose()
4 | Convert one or more column indexes to and from current and original indexes
5 | 1.3.0
6 |
7 |
8 | colReorder.transpose( idx [, direction ] )
9 |
10 | The index, or array of indexes to transpose.
11 |
12 |
13 | Set what transposition is required. This can be one of:
14 |
15 | * `-string toCurrent` - the input value is an original index and you wish to know its current index
16 | * `-string toOriginal` - the input value is the current index and you wish to know its original index
17 | * `-string fromOriginal` - As `-string toCurrent`
18 | * `-string fromCurrent` - As `-string toOriginal`.
19 |
20 |
21 | Get one or more current column indexes form their original index.
22 |
23 | The transpose values
24 |
25 |
26 |
27 | ColReorder will change the indexes of columns when columns are reordered and it can often be useful to convert between the original column index and the current column index. This method provides that ability.
28 |
29 | This ability to transpose between current and original values can be really useful if you have a reference to a column (`dt-api column().index()`) and you want to ensure that your index refers to the correct column, regardless of ordering.
30 |
31 | For example consider column index 0 is moved by the end user to index 5. You need to find out what its index is - this method provides that ability.
32 |
33 | Note that if ColReorder is not enabled on the target table this method can still be safely called - the input data will simply be returned (since no transposition is required).
34 |
35 |
36 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/event/column-reorder.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | column-reorder
4 | Columns have been reordered by the end user or API
5 | 1.2.0
6 |
7 |
8 | function( e, settings, details )
9 |
10 | jQuery event object
11 |
12 |
13 | DataTables settings object for the table that has been modified
14 |
15 |
16 | An object that contains information about the reordered columns:
17 |
18 | * `-type array` `from` - An array of the column indexes that are being moved
19 | * `-type integer` `to` - Column index that the column has been moved to
20 | * `-type array` `mapping` - Array of integers that define how the old column positions map to the new positions
21 |
22 | HTML table element
23 |
24 |
25 |
26 | When using ColReorder you may wish to know when a table has been reordered by an end user or through the API. This event provides that information.
27 |
28 | This event is triggered when a column's data structure is moved internally - it does not signify that the reordering has been completed for all columns. For example the `-api colReorder.order()` method can cause multiple column reordering actions. Listen for `-event columns-reordered` to know then all columns have been updated and the table is fully up to date with the requested action.
29 |
30 | Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, or use the `dt-api on()` method to listen for the event which will automatically append this namespace.
31 |
32 |
33 |
48 |
--------------------------------------------------------------------------------
/docs/event/columns-reordered.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | columns-reordered
4 | Column reordering is finished and table updated
5 | 2.0
6 |
7 |
8 | function( e, details )
9 |
10 | jQuery event object
11 |
12 |
13 | An object that contains information about the reordered columns:
14 |
15 | * `-type array` `order` - Current column order (`-api colReorder.order()`)
16 | * `-type array` `mapping` - Array of integers that define how the old column positions map to the new positions
17 |
18 | HTML table element
19 |
20 |
21 |
22 | This event let's you know when column reordering has finished. That might be after an individual call to `-api colReorder.move()` (which is used by the UI drag and drop reordering), or after all updates required by a call to `-api colReorder.order()`.
23 |
24 | The `-event column-reorder` event can also be used to know when reordering happens - it happens for every reorder action (i.e. it might trigger multiple times from `-api colReorder.order()`).
25 |
26 | Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, or use the `dt-api on()` method to listen for the event which will automatically append this namespace.
27 |
28 |
29 |
38 |
--------------------------------------------------------------------------------
/docs/option/colReorder.columns.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.columns
4 | Select which columns can be reordered
5 |
6 |
7 |
8 | Any column selector, including class names, CSS pseudo selectors and column indexes.
9 |
10 |
11 |
12 |
13 | Empty string - all columns can be reordered.
14 |
15 |
16 |
17 | This option can be used to select which columns ColReorder will allow the end user to perform reordering on. Columns which are not selected cannot have column reordering started on them (i.e. can't click and drag a header for them), nor can another column that is being reordered be dropped in this column's position.
18 |
19 | Locking columns in this way can be particularly useful if you have important information or controls at the start / end of a table that you want to always be in the same place.
20 |
21 | Please note that this method does not have any impact on column reordering via the API (e.g. `-api colReorder.move()` and `-api colReorder.order()`). If you have your own UI layer for column reordering that uses those methods, you will need to implement any column reordering restrictions you might want to impose on the end user.
22 |
23 | Please note that this option replaces the `colReorder.fixedColumnsLeft` and `colReorder.fixedColumnsRight` options from ColReorder 1.x.
24 |
25 |
26 |
33 |
--------------------------------------------------------------------------------
/docs/option/colReorder.enable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.enable
4 | Initial enablement state of ColReorder
5 | 1.5.0
6 |
7 |
8 |
9 | * `true` - ColReorder is enabled when the DataTable is created
10 | * `false` - ColReorder is not enabled, and can later be enabled via the API.
11 |
12 |
13 |
14 |
15 | ColReorder is enabled
16 |
17 |
18 |
19 | It can be useful to disable ColReorder's user input controls at certain times, depending on the state of your application. This option provides that ability when the table is initially created, while the `-api colReorder.enable()` and `-api colReorder.disable()` methods provide the option to enabling the user interaction after the table has been created.
20 |
21 |
22 |
29 |
30 | -init colReorder.enable
31 | -api colReorder.enable()
32 | -api colReorder.disable()
33 |
34 |
--------------------------------------------------------------------------------
/docs/option/colReorder.headerRows.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.headerRows
4 | Select which columns can be reordered
5 | 2.1.0
6 |
7 |
8 |
9 | An array of the header row indexes that should be considered for the ColReorder drag and drop action.
10 |
11 |
12 |
13 |
14 | If null, then all header cells will received a click and drag listener (allowing for `-init colReorder.columns`).
15 |
16 |
17 |
18 | If you have a header in your DataTable that spans multiple rows, you might wish to only have the event handler for ColReorder's click and drag action apply to a specific row in the header (e.g. if you use a second row for column search inputs). This option provides that ability by being able to specify which rows the click and drag listener should be applied to.
19 |
20 |
21 |
28 |
--------------------------------------------------------------------------------
/docs/option/colReorder.order.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder.order
4 | Set a default order for the columns in the table
5 |
6 |
7 |
8 | An array of integer values that define the order the columns should appear in. The position in the array is the position the column will take, and the value is the current column index that should be shown in that new position.
9 |
10 | The array _must_ contain all columns in the table, and cannot contain duplicates.
11 |
12 |
13 |
14 |
15 | The table's default column ordering will be used
16 |
17 |
18 |
19 | This option provides the option to define a default order for the columns in a table. Typically you will wish to have the columns in the order defined in the HTML, or from state saving (`dt-init stateSave`), but if required, this option can be used to define an initial default order.
20 |
21 |
22 |
29 |
30 | cr-api colReorder.order()
31 |
--------------------------------------------------------------------------------
/docs/option/colReorder.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | colReorder
4 | Enable and configure the ColReorder extension for DataTables
5 |
6 |
7 |
8 | As a boolean value this property will enable ColReorder on the DataTable that is being created. `true` will enable ColReorder, while `false` will not.
9 |
10 | This is a short-cut option to enable ColReorder with the default configuration options. Customisations can be made by giving this parameter as an object, see below.
11 |
12 |
13 |
14 |
15 |
16 | If given as an object, ColReorder will be enabled on the target DataTable, with default values (`$.fn.dataTable.ColReorder.defaults`) extended, and potentially overwritten, by the options provided in this object. This is how ColReorder can be configured on an individual table basis, or through the defaults.
17 |
18 |
19 |
20 |
21 | ColReorder will not be initialised by default
22 |
23 |
24 |
25 | ColReorder provides the option for end users to reorder columns in a DataTable by click and drag, or for yourself, the developer using DataTable, through the API.
26 |
27 | This option provides the ability to enable and configure ColReorder for DataTables. In its simplest form as the boolean `true` it will enable ColReorder with the default configuration options (as defined by `$.fn.dataTable.ColReorder.defaults`). It can also be used as an object to provide custom configuration options as described below.
28 |
29 | Please note that as with all other configuration options for ColReorder, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
30 |
31 |
32 |
37 |
38 |
45 |
46 |
--------------------------------------------------------------------------------
/examples/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ColReorder examples
5 |
6 |
7 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/initialisation/col_filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | tfoot input {
6 | width: 100%;
7 | }
8 |
9 |
10 | ')
22 | .appendTo($(column.footer()).empty())
23 | .on('keyup change clear', function () {
24 | if (column.search() !== this.value) {
25 | api
26 | .column(
27 | $(this)
28 | .parent()
29 | .index() + ':visible'
30 | )
31 | .search(this.value)
32 | .draw();
33 | }
34 | });
35 | });
36 | }
37 | });
38 |
39 | ]]>
40 |
41 |
42 |
43 | {
61 | if (column.search() !== this.value) {
62 | let idx = [...th.parentNode.children].indexOf(th);
63 |
64 | api
65 | .column(idx + ':visible')
66 | .search(input.value)
67 | .draw();
68 | }
69 | });
70 | });
71 | }
72 | });
73 |
74 | ]]>
75 |
76 |
77 | Individual column filtering
78 |
79 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/examples/initialisation/column-selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
23 |
24 |
25 | Selected columns
26 |
27 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/examples/initialisation/complex-header-row.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
23 |
24 |
25 | Complex headers - specific row
26 |
27 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/examples/initialisation/complex-header.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
19 |
20 |
21 | Complex headers - all cells
22 |
23 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/examples/initialisation/enableDisable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
32 |
33 |
34 |
35 |
61 |
62 |
63 | Enable / disable API
64 |
65 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/examples/initialisation/footer_callback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
46 |
47 |
48 |
49 | intVal(a) + intVal(b), 0);
70 |
71 | // Total over this page
72 | pageTotal = api
73 | .column(currentPosition, { page: 'current' })
74 | .data()
75 | .reduce((a, b) => intVal(a) + intVal(b), 0);
76 |
77 | // Update footer
78 | api.column(currentPosition).footer().innerHTML =
79 | '$' + pageTotal + ' ( $' + total + ' total)';
80 | }
81 | });
82 |
83 | ]]>
84 |
85 |
86 | Footer callback
87 |
88 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/examples/initialisation/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Initialisation
5 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/examples/initialisation/new_init.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
19 |
20 |
21 | Initialisation using `new`
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/examples/initialisation/orthogonal-data-attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
19 |
20 |
21 | HTML5 data-* orthogonal data
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/examples/initialisation/predefined.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
24 |
25 |
26 | Predefined column ordering
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/examples/initialisation/reset.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
16 |
17 |
18 |
19 | {
25 | table.colReorder.reset();
26 | });
27 |
28 | ]]>
29 |
30 |
31 | Reset ordering API
32 |
33 |
40 |
41 |
42 |
43 |