Lines Matching +defs:a +defs:name
37 // jQuery's factory checks for a global window - if it isn't present then it
38 // returns a factory function that expects the window object
44 // CommonJS environments without a window global must pass a
71 // Check if called with a window or jQuery object for DOM less applications
77 // When creating with `new`, create a new DataTable, returning the API instance
87 * Perform a jQuery selector action on the table's TR elements (from the tbody) and
115 * // Filter to rows with 'Webkit' in them, add a background colour and then
133 * create the row (or a generated array if from a DOM source).
147 * @returns {array} Data for the matched elements. If any elements, as a result of the
148 * selector, were not TR, TD or TH elements in the DataTable, they will have a null
183 * Create a DataTables Api instance, with the currently selected tables for
202 * Add a single new row or multiple rows of data to the table. Please note
208 * <li>1D array of data - add a single row with the data provided</li>
209 * <li>2D array of arrays - add multiple rows in a single call</li>
260 * parent element changes (for example a window resize).
294 * Quickly and simply clear a table
318 * The exact opposite of 'opening' a row, this function will close any rows which
329 * // 'open' an information row when a row is clicked on
348 * Remove a row for the table
466 * a TR node then the data source for the whole row will be returned. If given as a
544 * Get the array indexes of a particular cell from it's DOM element
546 * @param {node} node this can either be a TR, TD or TH in the table's body
547 * @returns {int} If nNode is given as a TR, then a single index is returned, or
548 * if given as a cell, an array of [row index, column index (visible),
593 * Check to see if a row is 'open' or not.
603 * // 'open' an information row when a row is clicked on
622 * This function will place a new row directly after a row which is currently
624 * function. This can be used, for example, to ask for confirmation that a
639 * // 'open' an information row when a row is clicked on
662 * Change the pagination - provides the internal logic for pagination in a simple API
663 * function. With this function you can have a DataTables table go to the next,
688 * Show a particular column
714 * Get the settings for a particular table for external manipulation
736 * Sort the table by a particular column
757 * Attach a sort listener to an element for a given column
759 * @param {int} iColumn the column that a click on this node will sort on
779 * Update a table cell or row - this method will accept either a single value to
786 * update a whole row.
797 * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row
823 * Provide a common method for plug-ins to check the version of DataTables being used, in order
860 // For each initialisation we want to give it a clean initialisation
895 /* Check to see if we are re-initialising a table */
926 /* If the element we are initialising has the same ID as a table which was previously
972 // Apply the defaults and init options to make a single init object will all
1070 /* Get the language definitions from a file - because this Ajax call makes the language
1130 /* If not given a column array, generate one with nulls */
1159 var a = function ( cell, name ) {
1160 return cell.getAttribute( 'data-'+name ) !== null ? name : null;
1171 var sort = a( cell, 'sort' ) || a( cell, 'order' );
1172 var filter = a( cell, 'filter' ) || a( cell, 'search' );
1193 * @todo For modularisation (1.11) this needs to do into a sort start up handler
1205 /* Do a first pass on the sorting classes (allows any size changes to be taken into
1257 // If we are a scrolling table, and no footer has been given, then we need to create
1258 // a tfoot element for the caption element to be appended to
1373 // Convert from a formatted number with characters other than `.` as the
1374 // decimal place, to a Javascript number
1394 // If empty return immediately so there must be a number if it is a
1396 // as a formatted number for currency
1433 var _pluck = function ( a, prop, prop2 ) {
1435 var i=0, ien=a.length;
1441 if ( a[i] && a[i][ prop ] ) {
1442 out.push( a[i][ prop ][ prop2 ] );
1448 if ( a[i] ) {
1449 out.push( a[i][ prop ] );
1458 // Basically the same as _pluck, but rather than looping over `a` we use `order`
1459 // as the indexes to pick from `a`
1460 var _pluck_order = function ( a, order, prop, prop2 )
1469 if ( a[ order[i] ][ prop ] ) {
1470 out.push( a[ order[i] ][ prop ][ prop2 ] );
1476 out.push( a[ order[i] ][ prop ] );
1506 var _removeEmpty = function ( a )
1510 for ( var i=0, ien=a.length ; i<ien ; i++ ) {
1511 if ( a[i] ) { // careful - will remove all falsy values!
1512 out.push( a[i] );
1529 * cut the _unique method at the cost of a single loop. A sorted array is used
1557 * Find the unique elements in a source array.
1646 * create a DataTable, but which are not exclusively used only for DataTables.
1654 * Throttle the calls to a function. Arguments and context are maintained
1690 * Escape a string such that it can be used in a regular expression
1700 * Create a function that will write to a nested object or array
1725 // Like the get, we need to get data from a nested object
1727 var a = _fnSplitObjNotation( src ), b;
1728 var aLast = a[a.length-1];
1731 for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ ) {
1733 if (a[i] === '__proto__' || a[i] === 'constructor') {
1738 arrayNotation = a[i].match(__reArray);
1739 funcNotation = a[i].match(__reFn);
1742 a[i] = a[i].replace(__reArray, '');
1743 data[ a[i] ] = [];
1746 b = a.slice();
1755 data[ a[i] ].push( o );
1762 data[ a[i] ] = val;
1771 a[i] = a[i].replace(__reFn, '');
1772 data = data[ a[i] ]( val );
1777 if ( data[ a[i] ] === null || data[ a[i] ] === undefined ) {
1778 data[ a[i] ] = {};
1780 data = data[ a[i] ];
1789 // If array notation is used, we just want to strip it and use the property name
1808 * Create a function that will read nested objects from arrays, based on JSON notation
1814 // Build an object of get functions, and wrap them in a single call
1843 /* If there is a . in the source string then the data source is in a
1853 var a = _fnSplitObjNotation( src );
1855 for ( var i=0, iLen=a.length ; i<iLen ; i++ ) {
1857 arrayNotation = a[i].match(__reArray);
1858 funcNotation = a[i].match(__reFn);
1862 a[i] = a[i].replace(__reArray, '');
1865 if ( a[i] !== "" ) {
1866 data = data[ a[i] ];
1871 a.splice( 0, i+1 );
1872 innerSrc = a.join('.');
1881 // If a string is given in between the array notation indicators, that
1892 a[i] = a[i].replace(__reFn, '');
1893 data = data[ a[i] ]();
1897 if (data === null || data[ a[i] ] === null) {
1900 else if ( data === undefined || data[ a[i] ] === undefined ) {
1904 data = data[ a[i] ];
1927 * Create a mapping object that allows camel case parameters to be looked up
1928 * for their Hungarian counterparts. The mapping is stored in a private
1936 hungarian = 'a aa ai ao as b fn i m o s ',
1961 * Convert from camel case parameters to Hungarian, based on a Hungarian map
1966 * @param {boolean} force When set to `true`, properties which already have a
2040 // Old parameter name of the thousands separator mapped onto the new
2056 * @param {*} knew The new parameter name
2057 * @param {*} old The old parameter name
2187 // IE6/7 will oversize a width 100% element inside a scrolling element, to
2242 * Add a column to the list used for the table with default values
2262 // passed into extend can be undefined. This allows the user to give a default
2263 // with only some of the parameters defined, and also not give a default
2273 * Apply options for a column
2318 // `class` is a reserved word in Javascript, so we need to provide
2319 // the ability to use a valid name for the camel case input
2414 * do a redraw after calling this function!
2443 * Convert the index of a visible column to the index in the data array (take account
2487 // No reduce in IE8, use a loop for now
2499 * Get an array of column indexes that match a given property
2508 var a = [];
2512 a.push( i );
2516 return a;
2521 * Calculate the 'type' of a column
2544 // Use a cache array so we only need to get the type data
2561 // Only a single match is needed for html type since it is
2589 * definition found for a column to a suitable configuration object.
2642 /* Class name matching on TH element */
2667 * Add a data array to the table, creating DOM node etc. This is the parallel to
2668 * _fnGatherData, but for adding rows from a Javascript source, rather than a
2673 * DataTables will create a row automatically
2721 * use this for reading data from a DOM sourced table, but it could be
2722 * used for an TR element. Note that if a TR is given, it is used (i.e.
2746 * Take a TR element and convert it to an index in aoData
2759 * Take a TD element and convert it into a column data index (not the visible index)
2773 * Get the data for a given cell from the internal cache, taking into account data mapping
2810 // When the data source is null and a specific data type is requested (i.e.
2816 // If the data source is a function, then we run it and use the return,
2838 * Set the value for a specific cell, into the internal data cache
2876 * Return a function that can be used to get data from a source object, taking
2877 * into account the ability to use nested objects as a source
2886 * Return a function that can be used to set data from a source object, taking
2887 * into account the ability to use nested objects as a source
2922 * Take an array of integers (index array) and remove a target integer (value - not
2924 * @param {array} a Index array to target
2928 function _fnDeleteIndex( a, iTarget, splice )
2932 for ( var i=0, iLen=a.length ; i<iLen ; i++ )
2934 if ( a[i] == iTarget )
2938 else if ( a[i] > iTarget )
2940 a[i]--;
2946 a.splice( iTargetIndex, 1 );
2952 * Mark cached data as invalid such that a re-read of the data will occur when
2963 * @todo For the modularisation of v1.11 this will need to become a callback, so
2974 // even if there is a reference to them elsewhere
3011 // Invalidate the type for a specific column (if given) or all columns since
3029 * Build a data source object from an HTML row, reading the contents of the
3041 * caller, so rather than needing a second traversal to get them, just return
3050 name, col, o, i=0, contents,
3073 // Read data from a cell and store into the data object
3109 name = td.nodeName.toUpperCase();
3111 if ( name == "TD" || name == "TH" ) {
3145 * Create a new TR element (and it's TD children) for a row
3149 * DataTables will create a row automatically
3170 /* Use a private property on the node to allow reserve mapping from the node
3197 // Need to create the HTML if new, or if a rendering function is defined
3234 * Add attributes to a row based on the special `DT_*` parameters in a data
3254 var a = data.DT_RowClass.split(' ');
3256 _unique( row.__rowc.concat( a ) ) :
3257 a;
3360 * traversed over cell at a time in a rows x columns grid fashion, although each
3363 * already a cell in that position.
3387 /* Make a copy of the master layout array, but without the visible columns in it */
3424 /* Check to see if there is already a cell (row/colspan) covering our target
3470 // Allow for state saving and a custom start position
3473 /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
3549 /* Table is empty - create a row with an empty message in it */
3580 /* Call all required callback functions for the end of a draw */
3642 // All DataTables are wrapped in a div
3665 /* Check to see if we should append an id and/or a class name to the container */
3784 * create a layout grid (array) of rows x columns, which contains a reference
3797 var fnShiftCol = function ( a, i, j ) {
3798 var k = a[i];
3813 /* Calculate a layout array */
3937 var match = val.name.match(rbracket);
3941 var name = match[0];
3943 if ( ! tmp[ name ] ) {
3944 tmp[ name ] = [];
3946 tmp[ name ].push( val.value );
3949 tmp[val.name] = val.value;
4031 return { name: key, value: val };
4046 // Is a function - let the caller define what needs to be done
4087 * Build up the parameters in an object needed for a server-side processing
4088 * request. Note that this is basically done twice, is different ways - a modern
4090 * arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if
4112 var param = function ( name, value ) {
4113 data.push( { 'name': name, 'value': value } );
4143 name: column.sName,
4251 * Get the data from the JSON data source to use for drawing a table. Using
4252 * `_fnGetObjectDataFn` allows the data to be sourced from a property of the
4253 * source object, or from a processing function.
4382 * @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)
4467 * Filter the table on a per-column basis
4471 * @param {bool} bRegex treat search string as a regular expression or not
4503 * @param {int} force optional - force a research of the master array (1) or not (undefined or 0)
4504 * @param {bool} regex treat as a regular expression or not
4557 * Build a regular expression object suitable for searching a table
4559 * @param {bool} bRegex treat as a regular expression or not
4574 * order is important - a la google. So this is what we want to
4579 var a = $.map( search.match( /["\u201C][^"\u201D]+["\u201D]|[^ ]+/g ) || [''], function ( word ) {
4592 search = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';
4600 * Escape a string such that it can be used in a regular expression
4646 // we could use a single line of jQuery to do this, but the DOM
4872 // a filter, and therefore cleared it before. So we need to make
4941 'name': tableId+'_length',
5012 /* Add a draw callback for the pagination on first instance, to update the paging display */
5325 // Given that this is such a monster function, a lot of variables are use
5427 // Size the table as a whole
5434 // - which is shouldn't. When there is a scrollbar we need to take this
5519 // Sanity check that the table is of a sensible width. If not then we are going to get
5523 // The min width depends upon if we have a vertical scrollbar visible or not */
5529 // IE6/7 are a law unto themselves...
5536 // And give the user a warning that we've stopped the table getting too small
5559 /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
5573 // Figure out if there are scrollbar present - if so then we need a the header and footer to
5574 // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
5601 * Apply a given function to the display child nodes of an element array (typically
5701 // Otherwise construct a single row, worst case, table with the widest
5761 // Tidy the temporary table - remove name attributes so there aren't
5763 $('[name]', tmpTable).removeAttr('name');
5810 // table. This is safe since DataTables requires a unique cell for each
5811 // column, but if ever a header can span multiple columns, this will
5838 // If there is a width attr, we want to attach an event listener which
5841 // CSS is a relative value or absolute - DOM read is always px.
5853 // IE6/7 will crash if we bind a resize event handler on page load.
5868 * Throttle the calls to a function. Arguments and context are maintained for
5879 * Convert a CSS unit width to pixels (e.g. 2em)
5950 * Append a CSS unit (only if required) to a string
5967 // Check it has a unit character already
5986 add = function ( a ) {
5987 if ( a.length && ! Array.isArray( a[0] ) ) {
5989 nestedSort.push( a );
5993 $.merge( nestedSort, a );
6063 // @todo Can this be moved into a 'data-ready' handler which is called when
6084 // Create a value - key array of the current row positions such that we can use their
6090 /* Do the sort - here we want multi-column sorting based on a given data source (column)
6091 * and sorting function (from oSort) in a certain direction. It's reasonably complex to
6093 * fnLocalSorting = function(a,b){
6101 * return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
6103 * Basically we have a test for each sorting column, if the data in that column is equal,
6104 * test the next column. If all columns match, then we use a numeric sort on the row
6105 * positions in the original data array to provide a stable sort.
6109 * methods which do not have a pre-sort formatting function.
6113 displayMaster.sort( function ( a, b ) {
6117 dataA = aoData[a]._aSortData,
6132 x = aiOrig[a];
6138 // Depreciated - remove in 1.11 (providing a plug-in option)
6141 displayMaster.sort( function ( a, b ) {
6145 dataA = aoData[a]._aSortData,
6161 x = aiOrig[a];
6234 var next = function ( a, overflow ) {
6235 var idx = a._idx;
6237 idx = $.inArray( a[1], asSorting );
6294 // Run the sort by calling a full redraw
6305 * Attach a sort handler (click) to a node
6322 // If processing is enabled use a timeout to allow the processing
6381 // Get the data to sort a column, be it from cache, fresh (populating the
6382 // cache), or from a sort formatter
6409 customData[i] : // If there was a custom sort function, use data from there
6422 * Save the state of a table
6458 * Attempt to load a saved table state
6602 * Return the settings object for a particular table
6603 * @param {node} table table we are using as a dataTable
6662 * See if a property is defined on one object, if so assign it to the other object
6665 * @param {string} name property
6666 * @param {string} [mappedName] name to map too - optional, name used if not given
6669 function _fnMap( ret, src, name, mappedName )
6671 if ( Array.isArray( name ) ) {
6672 $.each( name, function (i, val) {
6685 mappedName = name;
6688 if ( src[name] !== undefined ) {
6689 ret[mappedName] = src[name];
6704 * if they are present. This is so you can pass in a collection to
6739 * Bind an event handers to allow a click or return key to activate the callback.
6740 * This is good for accessibility since a return on the keyboard will have the
6741 * same effect as a click, if the element has focus.
6768 * Register a callback function. Easily allows a callback function to be added to
6773 * @param {string} sName Identifying name for the callback (i.e. a label)
6879 * a little (ajax) and to make it compress a little smaller.
6911 * name: 'data' -- string - Property name
6917 * name: 'row'
6922 * name: 'data'
6951 * Each of the input parameter types will be converted to a DataTables settings
6959 * * `node` - `TABLE` node which has already been formed into a DataTable.
7012 * The API class is heavily based on jQuery, presenting a chainable interface
7014 * a "context" - i.e. the tables that it will operate on. This could be a single
7015 * table, all tables on a page or a sub-set thereof.
7023 * configuration). The API object has a number of array like methods (`push`,
7025 * `unique` etc) to assist your working with the data held in a table.
7028 * the return from a method call also has all of the methods available that the
7045 * * `node` - `TABLE` node which has already been formed into a DataTable.
7055 * // Initialisation using a DataTables jQuery object
7059 * // Initialisation as a constructor
7070 var a = _toSettings( o );
7071 if ( a ) {
7072 settings.push.apply( settings, a );
7148 var a = [];
7151 a = __arrayProto.filter.call( this, fn, this );
7157 a.push( this[i] );
7162 return new _Api( this.context, a );
7168 var a = [];
7169 return new _Api( this.context, a.concat.apply( a, this.toArray() ) );
7188 a = [], ret,
7209 a.push( ret );
7217 a.push( ret );
7240 a.push( ret );
7246 if ( a.length || alwaysNew ) {
7247 var api = new _Api( context, flatten ? a.concat.apply( [], a ) : a );
7270 var a = [];
7273 a = __arrayProto.map.call( this, fn, this );
7278 a.push( fn.call( this, this[i], i ) );
7282 return new _Api( this.context, a );
7329 sort: __arrayProto.sort, // ? name - order?
7387 obj[ struct.name ] = struct.type === 'function' ?
7393 obj[ struct.name ].__dt_wrapper = true;
7396 _Api.extend( scope, obj[ struct.name ], struct.propExt );
7402 // _Api.augment = function ( inst, name )
7404 // // Find src object in the structure from the name
7405 // var parts = name.split('.');
7413 // name: 'data' -- string - Property name
7419 // name: 'row'
7424 // name: 'data'
7434 _Api.register = _api_register = function ( name, val )
7436 if ( Array.isArray( name ) ) {
7437 for ( var j=0, jen=name.length ; j<jen ; j++ ) {
7438 _Api.register( name[j], val );
7445 heir = name.split('.'),
7449 var find = function ( src, name ) {
7451 if ( src[i].name === name ) {
7467 name: key,
7527 var __table_selector = function ( selector, a )
7531 return __table_selector(item, a);
7535 // Integer is used to pick out a table by index
7537 return [ a[ selector ] ];
7540 // Perform a jQuery selector on the table nodes
7541 var nodes = $.map( a, function (el, i) {
7550 return a[ idx ];
7561 * @name DataTable.Api#tables
7564 * used. This can be given as a jQuery selector (for example `':gt(0)'`) to
7565 * select multiple tables or as an integer to select a single table.
7566 * @returns {DataTable.Api} Returns a new API instance if a selector is given.
7569 // A new instance is created if there was a selector specified
7652 * Note that if you attempt to show a page which does not exist, DataTables will
7680 * with a suitable selector.
7689 * only 2 records to show on the final page, with a length of 10.
7732 // is a Javascript property of functions which defines how many arguments
7749 // Use the draw event to trigger a callback
7880 * available when `ajax.url()` is used to set a URL. Additionally, this method
7882 * convenience when setting a new URL. Like `ajax.reload()` it will
7888 // Same as a reload, but makes sense to present it for easy access after a
7902 a, i, ien, j, jen,
7913 a = selector[i] && selector[i].split && ! selector[i].match(/[\[\(:]/) ?
7917 for ( j=0, jen=a.length ; j<jen ; j++ ) {
7918 res = selectFn( typeof a[j] === 'string' ? (a[j]).trim() : a[j] );
7983 i, ien, tmp, a=[],
7995 // Removed is a special case - for consistency just return an empty
8006 a.push( displayFiltered[i] );
8011 a = displayMaster.slice();
8014 a = displayFiltered.slice();
8017 // O(n+m) solution by creating a hash map
8024 a = $.map( displayMaster, function (el) {
8034 a.push( i );
8042 a.push( i );
8048 return a;
8070 // Short cut - selector is a number and no options provided (default is
8124 // jQuery here - hence a custom implementation. This does not match
8126 // but to select it using a CSS selector engine (like Sizzle or
8129 // only a row. A # indicates an id any anything that follows is the id -
8217 var a = [];
8224 a.push( (hash === true ? '#' : '' )+ id );
8228 return new _Api( context, a );
8365 // Allow a jQuery object to be passed in - only a single row is added from
8390 // This could be more compact with the API, but it is a lot faster as a simple
8435 // If we get a TR element, then just add it directly - up to the dev
8441 // Otherwise create a row with a wrapper
8557 // a colspan)
8664 * "{string}:name" - column name
8672 var __re_column_selector = /^([^:]+):(name|visIdx|visible)$/;
8678 var a = [];
8680 a.push( _fnGetCellData( settings, rows[row], column ) );
8682 return a;
8705 columns.length + selInt // Count from right (+ because its a negative value)
8743 case 'name':
8744 // match by name. `names` is column index complete and in order
8745 return $.map( names, function (name, i) {
8746 return name === match[1] ? i : null;
8771 // Otherwise a node which might have a `dt-column` data attribute, or be
8772 // a child or such an element
8962 var a, i, ien, j, o, host;
8969 a = [];
8985 a.push( o );
8990 a.push( o );
8995 return a;
9010 return { // use a new object, in case someone changes the values
9021 // Otherwise the selector is a node, and there is one last option - the
9022 // element might be a child of an element which has dt-row and dt-column
9079 var a = [];
9083 a.push( {
9090 return a;
9093 // There is currently only one extension which uses a cell selector extension
9094 // It is a _major_ performance drag to run this if it isn't needed, so this is
9193 * a column being sorted upon (i.e. multi-sorting with two columns would have
9235 // otherwise a 2D array was passed in
9244 * Attach a sort listener to an element for a given column
9247 * listener to. This can take the form of a single DOM node, a jQuery
9248 * collection of nodes or a jQuery selector which will identify the node(s).
9249 * @param {integer} column the column that a click on this node will sort on
9409 * given are a window object or a jQuery object. If so they are set
9418 // Test if the first parameter is a window object
9424 // Test if the second parameter is a jQuery object
9434 * Provide a common method for plug-ins to check the version of DataTables being
9472 * Check if a `<table>` node is a DataTable table already or not.
9477 * @returns {boolean} true the table given is a DataTable, or false otherwise
9533 var a = $.map( DataTable.settings, function (o) {
9540 new _Api( a ) :
9541 a;
9554 * @param {boolean} force When set to `true`, properties which already have a
9699 // classes - but it's a good effort without getting carried away
9718 // Add the `every()` method for rows, columns and cells in a compact form
9770 * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9780 * created for the tables on a given page.
9823 * Flag to indicate if the search term should be interpreted as a
9839 * Flag to indicate if DataTables should only trigger a search when
9876 * data from the data source, or will be an array if using DOM a data
9908 * in this case a string rather than an array. This is easily computed with
9909 * a join on `_aFilterData`, but is provided as a cache so the join isn't
9918 * Cache of the class name that DataTables has applied to the row, so we
9919 * can quickly look at this variable rather than needing to do a DOM check
9963 * is faster to just hold it as a variable
9972 * to be defined for a column (for example first name / last name columns
9974 * columns to be sorted on (typically it will be a single integer pointing
10028 * Developer definable function that is called whenever a cell is created (Ajax source,
10029 * etc) or processed for input (DOM source). This can be used as a compliment to mRender
10042 * Function to get data from a cell in a column. You should <b>never</b>
10058 * Function to set data for a cell in the column. You should <b>never</b>
10072 * source array / object. If null, then the default content is used, if a
10115 * it finds the longest string in each column and then constructs a
10117 * is that "mmm" is much wider then "iiii", but the latter is a longer
10120 * a "work around" we provide this option. It will append its value to the
10127 * Allows a default value to be given for a column's data, and will be used
10128 * whenever a null data source is encountered (this can be because mData
10136 * Name for the column, allowing reference to the column by name as well as
10137 * by index (needs a lookup to work by name).
10200 * - hence the @name tags in each doc comment. This allows a Javascript function
10201 * to create a map from Hungarian notation to camel case (going the other direction
10203 * of DataTables, while this method is about a 0.5K hit).
10206 * completely, but that is a massive amount of work and will break current
10220 * example with a custom Ajax call.
10225 * @name DataTable.defaults.data
10228 * // Using a 2D array data source
10246 * // Using an array of objects as a data source (`data`)
10279 * If ordering is enabled, then DataTables will perform a first pass sort on
10283 * the column's index and a direction string ('asc' or 'desc').
10288 * @name DataTable.defaults.order
10311 * is that you could have a column (visible or hidden) which the sorting
10319 * @name DataTable.defaults.orderFixed
10332 * DataTables can be instructed to load data to display in the table from a
10345 * As a string, the `ajax` property simply defines the URL from which
10353 * of the Ajax request. DataTables has a number of default parameters which
10355 * documentation for a full description of the options available, although
10360 * can also be used as a function to manipulate the data DataTables sends
10361 * to the server. The function takes a single parameter, an object of
10372 * object notation to get a data source for multiple levels of nesting, or
10373 * it my be used as a function. As a function it takes a single parameter,
10381 * use `ajax.dataSrc`, or use `ajax` as a function (see below).
10386 * As a function, making the Ajax call is left up to yourself allowing
10387 * complete control of the Ajax request. Indeed, if desired, a method other
10406 * @name DataTable.defaults.ajax
10410 * // Get JSON data from a file via Ajax.
10417 * // Get JSON data from a file via Ajax, using `dataSrc` to change
10427 * // Get JSON data from a file via Ajax, using `dataSrc` to read data
10428 * // from a plain array rather than an array in an object
10437 * // Manipulate the data returned from the server - add a link to data
10439 * // is just a simple example of how the data can be manipulated).
10445 * json[i][0] = '<a href="/message/'+json[i][0]+'>View message</a>';
10475 * // Get the data from localStorage (could interface with a form for
10491 * either a 1D array of options which will be used for both the displayed
10492 * option and the value, or a 2D array which will use the array in the first
10502 * @name DataTable.defaults.lengthMenu
10516 * details about the way individual columns behave. For a full list of
10524 * @name DataTable.defaults.column
10529 * Very similar to `columns`, `columnDefs` allows you to target a specific
10538 * <li>a string - class name will be matched on the TH for the column</li>
10539 * <li>0 or a positive integer - column index counting from the left</li>
10540 * <li>a negative integer - column index counting from the right</li>
10541 * <li>the string "_all" - all columns (i.e. assign a default)</li>
10545 * @name DataTable.defaults.columnDefs
10560 * @name DataTable.defaults.searchCols
10586 * @name DataTable.defaults.stripeClasses
10606 * @name DataTable.defaults.autoWidth
10619 * Deferred rendering can provide DataTables with a huge speed boost when you
10622 * each row until they are needed for a draw - saving a significant amount of
10628 * @name DataTable.defaults.deferRender
10642 * Replace a DataTable which matches the given selector and replace it with
10650 * @name DataTable.defaults.destroy
10672 * will match a row containing those words, even if not in the order that was
10681 * @name DataTable.defaults.searching
10701 * @name DataTable.defaults.info
10714 * Allows the end user to select the size of a formatted page from a select
10720 * @name DataTable.defaults.lengthChange
10738 * @name DataTable.defaults.paging
10751 * Enable or disable the display of a 'processing' indicator when the table is
10752 * being processed (e.g. a sort). This is particularly useful for tables with
10753 * large amounts of data where it can take a noticeable amount of time to sort
10759 * @name DataTable.defaults.processing
10777 * that you understand this). `destroy` can be used to reinitialise a table if
10783 * @name DataTable.defaults.retrieve
10812 * However, this can look odd when filtering data down to a small data set,
10820 * @name DataTable.defaults.scrollCollapse
10835 * `ajax` parameter must also be given in order to give DataTables a
10842 * @name DataTable.defaults.serverSide
10862 * @name DataTable.defaults.ordering
10881 * @name DataTable.defaults.orderMulti
10896 * cell that is found for a single column, or the bottom (false - default).
10902 * @name DataTable.defaults.orderCellsTop
10917 * presented as a feature switch as it can increase processing time (while
10924 * @name DataTable.defaults.orderClasses
10944 * `stateSaveCallback` to provide a storage solution such as cookies.
10949 * @name DataTable.defaults.stateSave
10962 * This function is called when a TR element is created (and all TD child
10963 * elements have been inserted), or registered if using a DOM source, allowing
10971 * @name DataTable.defaults.createdRow
10996 * @name DataTable.defaults.drawCallback
11024 * @name DataTable.defaults.footerCallback
11041 * to have a comma separator for the 'thousands' units (e.g. 1 million is
11050 * @name DataTable.defaults.formatNumber
11053 * // Format a number using a single quote for the separator (note that
11088 * @name DataTable.defaults.headerCallback
11120 * @name DataTable.defaults.infoCallback
11143 * @name DataTable.defaults.initComplete
11167 * @name DataTable.defaults.preDrawCallback
11186 * function might be used for setting the row class name etc.
11195 * @name DataTable.defaults.rowCallback
11218 * For example you could use POST data, or pull information from a Gears or
11231 * @name DataTable.defaults.serverData
11248 * @param {array} data Data array (array of objects which are name/value
11251 * this will be an empty array, for server-side processing there will be a
11258 * @name DataTable.defaults.serverParams
11267 * state of a table is loaded. By default DataTables will load from `localStorage`
11268 * but you might wish to use a server-side database or cookies.
11277 * @name DataTable.defaults.stateLoadCallback
11313 * a plug-in.
11319 * @name DataTable.defaults.stateLoadParams
11322 * // Remove a saved filter, so filtering is never loaded
11348 * and the DataTables settings object has been modified as a result of the loaded state.
11354 * @name DataTable.defaults.stateLoaded
11373 * but you might wish to use a server-side database or cookies.
11380 * @name DataTable.defaults.stateSaveCallback
11411 * has changed state a new state save is required. This method allows modification of
11414 * use the `stateSaveParams` event to save parameters for a plug-in.
11420 * @name DataTable.defaults.stateSaveParams
11423 * // Remove a saved filter, so filtering is never saved
11444 * @name DataTable.defaults.stateDuration
11457 * When enabled DataTables will not make a request to the server for the first
11463 * where a filtering is applied to the table on initial load, this can be
11472 * @name DataTable.defaults.deferLoading
11501 * Number of rows to display on a single page when using pagination. If
11503 * this to a custom setting using a pop-up menu.
11508 * @name DataTable.defaults.pageLength
11529 * @name DataTable.defaults.displayStart
11543 * and filtering) by adding a `tabindex` attribute to the required elements. This
11546 * You can overrule this using this parameter if you wish. Use a value of -1 to
11552 * @name DataTable.defaults.tabIndex
11570 * @name DataTable.defaults.classes
11580 * @name DataTable.defaults.language
11588 * @name DataTable.defaults.language.aria
11599 * @name DataTable.defaults.language.aria.sortAscending
11622 * @name DataTable.defaults.language.aria.sortDescending
11642 * @name DataTable.defaults.language.paginate
11652 * @name DataTable.defaults.language.paginate.first
11675 * @name DataTable.defaults.language.paginate.last
11698 * @name DataTable.defaults.language.paginate.next
11721 * @name DataTable.defaults.language.paginate.previous
11746 * @name DataTable.defaults.language.emptyTable
11778 * @name DataTable.defaults.language.info
11799 * @name DataTable.defaults.language.infoEmpty
11814 * When a user filters the information in a table, this string is appended
11821 * @name DataTable.defaults.language.infoFiltered
11844 * @name DataTable.defaults.language.infoPostFix
11859 * This decimal place operator is a little different from the other
11861 * numbers, so it won't ever use this for display of a number. Rather,
11863 * that numbers which are in a format which has a character other than
11864 * a period (`.`) as a decimal place will be sorted numerically.
11874 * @name DataTable.defaults.language.decimal
11890 * DataTables has a build in number formatter (`formatNumber`) which is
11892 * By default a comma is used, but this can be trivially changed to any
11898 * @name DataTable.defaults.language.thousands
11915 * with a default select list of 10, 25, 50 and 100, and can be replaced
11916 * with a custom select box if required.
11921 * @name DataTable.defaults.language.lengthMenu
11963 * @name DataTable.defaults.language.loadingRecords
11978 * Text which is displayed when the table is processing a user action
11979 * (usually a sort command or similar).
11983 * @name DataTable.defaults.language.processing
12007 * @name DataTable.defaults.language.search
12033 * Assign a `placeholder` attribute to the search `input` element
12038 * @name DataTable.defaults.language.searchPlaceholder
12044 * All of the language information can be stored in a file on the
12046 * It must store the URL of the language file, which is in a JSON format,
12054 * @name DataTable.defaults.language.url
12076 * @name DataTable.defaults.language.zeroRecords
12095 * the search string will be treated as a regular expression, when false
12096 * (default) it will be treated as a straight string. When `smart`
12103 * @name DataTable.defaults.search
12123 * get a data source for multiple levels of nesting.
12129 * @name DataTable.defaults.ajaxDataProp
12142 * already have). Simply provide a url a JSON object can be obtained from.
12148 * @name DataTable.defaults.ajaxSource
12159 * table). DIV elements (with or without a custom class) can also be added to
12181 * <li>'<"class" and '>' - div with a class</li>
12197 * @name DataTable.defaults.dom
12212 * `dt-api search()`, providing a delay before the search is made.
12217 * @name DataTable.defaults.searchDelay
12245 * @name DataTable.defaults.pagingType
12258 * Enable horizontal scrolling. When a table is too wide to fit into a
12259 * certain layout, or you have a large number of columns in the table, you
12260 * can enable x-scrolling to show the table in a viewport, which can be
12262 * scroll horizontally when needed, or any CSS unit, or a number (in which
12263 * case it will be treated as a pixel measurement). Setting as simply `true`
12269 * @name DataTable.defaults.scrollX
12283 * This property can be used to force a DataTable to use more width than it
12284 * might otherwise do when x-scrolling is enabled. For example if you have a
12287 * any CSS unit, or a number (in which case it will be treated as a pixel
12293 * @name DataTable.defaults.scrollXInner
12310 * a lot of data in a small area (although paging and scrolling can both be
12311 * enabled at the same time). This property can be any CSS unit, or a number
12312 * (in which case it will be treated as a pixel measurement).
12317 * @name DataTable.defaults.scrollY
12341 * @name DataTable.defaults.serverMethod
12350 * a table. These renderers can be added or modified by plug-ins to
12351 * generate suitable mark-up for a site. For example the Bootstrap
12352 * integration plug-in for DataTables uses a paging button renderer to
12360 * @name DataTable.defaults.renderer
12367 * Set the data property name that DataTables should use to get a row's id
12372 * @name DataTable.defaults.rowId
12393 * allows a column's ordering to take multiple columns into account when
12394 * doing a sort or use the data from a different column. For example first
12395 * name / last name columns make sense to do a multi-column sort over the
12400 * @name DataTable.defaults.column.orderData
12440 * @name DataTable.defaults.column.orderSequence
12477 * @name DataTable.defaults.column.searchable
12510 * @name DataTable.defaults.column.orderable
12543 * @name DataTable.defaults.column.visible
12572 * Developer definable function that is called whenever a cell is created (Ajax source,
12573 * etc) or processed for input (DOM source). This can be used as a compliment to mRender
12583 * @name DataTable.defaults.column.createdCell
12608 * @name DataTable.defaults.column.dataProp
12614 * including deeply nested objects / properties. `data` can be given in a
12622 * * `.` - Dotted Javascript notation. Just as you use a `.` in
12625 * `browser.name`. If your object parameter name contains a period, use
12626 * `\\` to escape it - i.e. `first\\.name`.
12629 * between the two brackets. For example: `name[, ]` would provide a
12633 * * `()` - Function notation. Adding `()` to the end of a parameter will
12634 * execute a function of the name given. For example: `browser()` for a
12635 * simple function on the data source, `browser.version()` for a
12636 * function in a nested property or even `browser().version` to get an
12639 * `data` as it is much simpler to use as a renderer.
12650 * needs to set or get the data for a cell in the column. The function
12664 * Note that `data` is a getter and setter option. If you just require
12666 * is simply a getter and thus simpler to use.
12669 * name change reflects the flexibility of this property and is consistent
12671 * be used by DataTables, as it automatically maps the old name to the new
12677 * @name DataTable.defaults.column.data
12730 * // Using `data` as a function to provide different information for
12770 * // Using array notation - outputting a list from an array
12775 * "data": "name[, ]"
12790 * this option can be given in a number of different ways to effect its
12798 * * `.` - Dotted Javascript notation. Just as you use a `.` in
12801 * `browser.name`. If your object parameter name contains a period, use
12802 * `\\` to escape it - i.e. `first\\.name`.
12805 * between the two brackets. For example: `name[, ]` would provide a
12809 * * `()` - Function notation. Adding `()` to the end of a parameter will
12810 * execute a function of the name given. For example: `browser()` for a
12811 * simple function on the data source, `browser.version()` for a
12812 * function in a nested property or even `browser().version` to get an
12819 * This is the default value to use if you haven't specified a value for
12822 * needs to set or get the data for a cell in the column. The function
12837 * @name DataTable.defaults.column.render
12841 * // Create a comma separated list from an array of objects
12850 * "render": "[, ].name"
12857 * // Execute a function to obtain data
12870 * // This would be used with a data source such as:
12873 * // (which has both forms) is used for filtering for if a user inputs either format, while
12890 * // Use as a function to create a link from the data source
12897 * return '<a href="'+data+'">Download</a>';
12909 * to act as a header for a row (you may wish to add scope='row' to the TH elements).
12913 * @name DataTable.defaults.column.cellType
12935 * @name DataTable.defaults.column.class
12966 * it finds the longest string in each column and then constructs a
12968 * is that "mmm" is much wider then "iiii", but the latter is a longer
12971 * a "work around" we provide this option. It will append its value to the
12977 * @name DataTable.defaults.column.contentPadding
12999 * Allows a default value to be given for a column's data, and will be used
13000 * whenever a null data source is encountered (this can be because `data`
13005 * @name DataTable.defaults.column.defaultContent
13051 * @name DataTable.defaults.column.name
13059 * { "name": "engine", "targets": [ 0 ] },
13060 * { "name": "browser", "targets": [ 1 ] },
13061 * { "name": "platform", "targets": [ 2 ] },
13062 * { "name": "version", "targets": [ 3 ] },
13063 * { "name": "grade", "targets": [ 4 ] }
13073 * { "name": "engine" },
13074 * { "name": "browser" },
13075 * { "name": "platform" },
13076 * { "name": "version" },
13077 * { "name": "grade" }
13086 * Defines a data source type for the ordering which can be used to read
13093 * @name DataTable.defaults.column.orderDataType
13133 * @name DataTable.defaults.column.title
13174 * @name DataTable.defaults.column.type
13207 * been given a specific width through this interface ensuring that the table
13212 * @name DataTable.defaults.column.width
13247 * DataTables settings object - this holds all the information needed for a
13249 * table options. DataTables does not have a single instance for each DataTable
13251 * DataTable "class" are created on-the-fly as needed (typically by a
13263 * into every single function. However, this is a very significant
13279 * set a default use {@link DataTable.defaults}.
13286 * needed by a driven page draw. This can give a significant speed
13290 * set a default use {@link DataTable.defaults}.
13300 * set a default use {@link DataTable.defaults}.
13309 * set a default use {@link DataTable.defaults}.
13315 * Present a user control allowing the end user to change the page size
13318 * set a default use {@link DataTable.defaults}.
13327 * set a default use {@link DataTable.defaults}.
13333 * Processing indicator enable flag whenever DataTables is enacting a
13336 * set a default use {@link DataTable.defaults}.
13346 * set a default use {@link DataTable.defaults}.
13354 * set a default use {@link DataTable.defaults}.
13362 * set a default use {@link DataTable.defaults}.
13368 * Apply a class to the columns which are being sorted to provide a
13370 * there is a lot of DOM interaction.
13372 * set a default use {@link DataTable.defaults}.
13380 * set a default use {@link DataTable.defaults}.
13388 * Scrolling settings for a table.
13396 * set a default use {@link DataTable.defaults}.
13413 * set a default use {@link DataTable.defaults}.
13422 * set a default use {@link DataTable.defaults}.
13432 * set a default use {@link DataTable.defaults}.
13459 * Indicate if the browser incorrectly calculates width:100% inside a
13561 * Store the applied global search information in case we want to force a
13562 * research or compare the old search to a new one.
13564 * set a default use {@link DataTable.defaults}.
13587 * set a default use {@link DataTable.defaults}.
13597 * set a default use {@link DataTable.defaults}.
13604 * Classes to use for the striping of a table.
13606 * set a default use {@link DataTable.defaults}.
13613 * If restoring a table - we should restore its striping classes as well
13620 * If restoring a table - we should restore its width
13627 * Callback functions array for every time a row is inserted (i.e. on a draw).
13747 * set a default use {@link DataTable.defaults}.
13772 * set a default use {@link DataTable.defaults}.
13788 * set a default use {@link DataTable.defaults}.
13797 * set a default use {@link DataTable.defaults}.
13809 * a JSON string to be inserted into a json object
13811 * <li>string:sName - name of callback</li>
13824 * <li>string:sName - name of callback</li>
13848 * set a default use {@link DataTable.defaults}.
13855 * Property from a given object from which to read the table data from. This
13859 * set a default use {@link DataTable.defaults}.
13890 * set a default use {@link DataTable.defaults}.
13907 * set a default use {@link DataTable.defaults}.
13915 * set a default use {@link DataTable.defaults}.
13923 * set a default use {@link DataTable.defaults}.
13930 * Counter for the draws that the table does. Also used as a tracker for
13938 * Indicate if a redraw is being done - useful for Ajax
14019 * set a default use {@link DataTable.defaults}.
14135 * Function used to get a row's id from the row's data
14142 * Data location where to store a row's id
14164 * This namespace acts as a collection area for plug-ins that can be used to
14207 * 'throw', 'none' or a function.
14226 * * `cFeature` - a character so the feature can be enabled by the `dom`
14239 * be useful when developing a plug-in which allows table control via
14259 * searching, and a lot more comprehensive as it allows you complete control
14260 * over the searching logic. Each element in this array is a function
14271 * from a DOM data source
14290 * // from the end-user, matching the data in a certain range.
14351 * anything other than a plug-in (and even then, try to avoid if possible).
14381 * Each entry in this object is a function and defines which buttons should
14405 * * `{array}` - A nested array containing the above elements to add a
14438 * order a column, but is necessarily therefore more complex.
14478 * Each column in DataTables has a type assigned to it, either by automatic
14480 * The type of a column will effect how it is ordering and search (plug-ins
14490 * a column's type, making initialisation of DataTables super easy, even
14498 * based on language settings such as using a comma for a decimal
14536 * Note that is a search is not defined for a column of a given type,
14540 * for a column (or have it automatically detected for you by DataTables
14541 * or a type detection plug-in), you will typically be using this for
14545 * functions this object with a parameter name which matches the sType
14549 * The functions defined take a single parameter:
14572 * when a column is sorted upon. The order for each type that is defined,
14588 * `{type}-pre`: Functions defined take a single parameter:
14613 * // Numeric ordering of formatted numbers with a pre-formatter
14616 * a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
14617 * return parseFloat( a );
14647 // The should not be used in new projects and will be removed in a future
14909 var tag = settings.oInit.pagingTag || 'a';
14976 // V8 tries _very_ hard to make a string passed into `Date.parse()`
14977 // valid, so we need to use a regex to restrict date formats. Use a
15058 // If a decimal place other than `.` is used, it needs to be given to the
15059 // function so we can detect it and replace with a `.` which is the only
15080 // in a function to provide an easy ability for the language options to add
15081 // additional methods if a non-period decimal place is used.
15109 // For HTML types add a search formatter that will strip the HTML
15127 "html-pre": function ( a ) {
15128 return _empty(a) ?
15130 a.replace ?
15131 a.replace( /<.*?>/g, "" ).toLowerCase() :
15132 a+'';
15136 "string-pre": function ( a ) {
15137 // This is a little complex, but faster than always calling toString,
15139 return _empty(a) ?
15141 typeof a === 'string' ?
15142 a.toLowerCase() :
15143 ! a.toString ?
15145 a.toString();
15168 // Attach a sort listener to update on sort - note that using the
15174 return; // table, not a nested one
15201 // Attach a sort listener to update on sort
15240 * to make working with DataTables a little bit easier.
15257 // Common logic for moment, luxon or a date action
15339 // The renderer gives us Moment, Luxon or Date obects for the sorting, all of which have a
15341 DataTable.ext.type.order[typeName + '-asc'] = function (a, b) {
15342 var x = a.valueOf();
15352 DataTable.ext.type.order[typeName + '-desc'] = function (a, b) {
15353 var x = a.valueOf();
15365 // Allow for a default value
15383 // Typing uses the type name for fast matching
15468 * option to provide a display renderer. The following functions are defined:
15519 // be a number after all)
15532 // If zero, then can't have a negative prefix
15557 * This is really a good bit rubbish this method of exposing the internal methods
15563 * Create a wrapper function for exporting an internal functions to an external API.
15564 * @param {string} fn API function name
15677 _fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant
15693 // With a capital `D` we return a DataTables API instance rather than a