Lines Matching +defs:a +defs:string

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
89 * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
91 * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter
93 * @param {string} [oOpts.order=current] Order of the TR elements in the processed array.
96 * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
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).
137 * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
139 * @param {string} [oOpts.filter=none] Select elements that meet the current filter
141 * @param {string} [oOpts.order=current] Order of the data in the processed array.
144 * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
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
430 * @param {string} sInput String to filter the table on
444 * oTable.fnFilter( 'test string' );
466 * a TR node then the data source for the whole row will be returned. If given as a
471 * @returns {array|object|string} If mRow is undefined, then the data for all rows is
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
627 * @param {string|node|jQuery} mHtml The HTML to put into the row
628 * @param {string} sClass Class to give the new TD cell
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,
665 * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
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
783 * @param {object|array|string} mData Data to update the cell/row with
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
825 * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
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 ) {
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
1380 return typeof num === 'string' && decimalPoint !== '.' ?
1388 var strType = type === 'string';
1394 // If empty return immediately so there must be a number if it is a
1395 // formatted string (this stops the string "k", or "kr", etc being detected
1396 // as a formatted number for currency
1413 // A string without HTML in it can be considered to be HTML still
1415 return _empty( d ) || typeof d === 'string';
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
1692 * @param {string} val string to escape
1693 * @returns {string} escaped string
1700 * Create a function that will write to a nested object or array
1701 * @param {*} source JSON notation string
1722 else if ( typeof source === 'string' && (source.indexOf('.') !== -1 ||
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] ];
1808 * Create a function that will read nested objects from arrays, based on JSON notation
1809 * @param {*} source JSON notation string
1814 // Build an object of get functions, and wrap them in a single call
1830 // Give an empty string for rendering / sorting etc
1840 else if ( typeof source === 'string' && (source.indexOf('.') !== -1 ||
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
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
2355 return typeof src === 'string' && src.indexOf('@') !== -1;
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
2501 * @param {string} sParam Parameter in aoColumns to look for - typically
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
2555 // scan all rows since it is possible to mix string and HTML
2561 // Only a single match is needed for html type since it is
2562 // bottom of the pile and very similar to string - but it
2577 // Fall back - if no type was detected, always use string
2579 col.sType = 'string';
2589 * definition found for a column to a suitable configuration object.
2640 else if ( typeof aTargets[j] === 'string' )
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
2777 * @param {string} type data get type ('display', 'type' 'filter|search' 'sort|order')
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
2863 * Split string on periods, taking into account escaped periods
2864 * @param {string} str String to split
2865 * @return {array} Split string
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
2878 * @param {string|int|function} mSource The data source for the object
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
2888 * @param {string|int|function} mSource The data source for the object
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
2957 * @param {string} [src] Source to invalidate from: undefined, 'auto', 'dom'
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
3062 if ( typeof str === 'string' ) {
3073 // Read data from a cell and store into the data object
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 */
3688 * breaks the string into parts and applies them as needed
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 */
4037 else if ( oSettings.sAjaxSource || typeof ajax === 'string' )
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
4198 * @param {string} json.sEcho Tracking flag for DataTables to match requests
4202 * @param {string} [json.sColumns] Column ordering (sName, comma separated)
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
4469 * @param {string} sInput string to filter on
4471 * @param {bool} bRegex treat search string as a regular expression or not
4502 * @param {string} input string to filter on
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
4558 * @param {string} sSearch string to search for
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
4601 * @param {string} sVal string to escape
4602 * @returns {string} escaped string
4630 // Search in DataTables 1.10 is string based. In 1.11 this
4636 if ( typeof cellData !== 'string' && cellData.toString ) {
4644 // If it looks like there is an HTML entity in the string,
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
5012 /* Add a draw callback for the pagination on first instance, to update the paging display */
5051 * @param {string|int} action Paging action to take: "first", "previous",
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
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)
5880 * @param {string} width width to be converted
5927 * @returns {string} max string length for each column
5950 * Append a CSS unit (only if required) to a string
5951 * @param {string} value to css-ify
5952 * @returns {string} value with css unit
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 );
6021 sType = aoColumns[ iCol ].sType || 'string';
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){
6095 * iTest = oSort['string-asc']('data11', 'data12');
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,
6154 fn = oExtSort[ sort.type+"-"+sort.dir ] || oExtSort[ "string-"+sort.dir ];
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
6622 * @param {string} msg error message
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
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
6771 * @param {string} sStore Name of the array storage for the callbacks in oSettings
6773 * @param {string} sName Identifying name for the callback (i.e. a label)
6794 * @param {string} callbackArr Name of the array storage for the callbacks in
6796 * @param {string} eventName Name of the jQuery custom event to trigger. If
6866 else if ( typeof renderer === 'string' ) {
6879 * a little (ajax) and to make it compress a little smaller.
6882 * @returns {string} Data source
6911 * name: 'data' -- string - Property name
6951 * Each of the input parameter types will be converted to a DataTables settings
6954 * @param {string|node|jQuery|object} mixed DataTable identifier. Can be one
6957 * * `string` - jQuery selector. Any DataTables' matching the given selector
6959 * * `node` - `TABLE` node which has already been formed into a DataTable.
6990 else if ( typeof mixed === 'string' ) {
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
7039 * @param {array|object|string|jQuery} context DataTable identifier. This is
7043 * * `string` - jQuery selector. Any DataTables' matching the given selector
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,
7195 if ( typeof flatten === 'string' ) {
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 );
7413 // name: 'data' -- string - Property name
7522 * @param {string|integer} [selector] jQuery selector string or integer
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 ];
7562 * @param {string|integer} [selector] Selector to pick which tables the iterator
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
7632 if ( typeof paging === 'string' ) {
7652 * Note that if you attempt to show a page which does not exist, DataTables will
7655 * @param {integer|string} action The paging action to take. This can be one of:
7657 * * `string` - An action to take:
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
7838 * @return {string} Current Ajax source URL
7843 * @param {string} url URL to set.
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,
7907 if ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) {
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;
8058 * {string} - jQuery selector to apply to the TR elements
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 -
8131 if ( typeof sel === 'string' && sel.charAt(0) === '#' ) {
8147 // Selector - jQuery selector string, array of nodes or jQuery object/
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)
8591 // string
8664 * "{string}:name" - column name
8665 * "{string}" - jQuery selector on column header nodes
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)
8722 // jQuery or string selector
8723 var match = typeof s === 'string' ?
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
9202 * @param {string} direction Direction of the sort to be applied (`asc` or `desc`)
9235 // otherwise a 2D array was passed in
9244 * Attach a sort listener to an element for a given column
9246 * @param {node|jQuery|string} node Identifier for the element(s) to attach the
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
9391 * @param {string} [type] Library or container type `lib`, `win` or `datetime`.
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
9437 * @param {string} version Version string to check for, in the format "X.Y.Z".
9472 * Check if a `<table>` node is a DataTable table already or not.
9474 * @param {node|jquery|string} table Table node, jQuery object or jQuery
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
9764 return typeof resolved === 'string'
9769 * Version string for plug-ins to check compatibility. Allowed format is
9770 * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9773 * @type string
9780 * created for the tables on a given page.
9817 * @type string
9818 * @default <i>Empty string</i>
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
9919 * can quickly look at this variable rather than needing to do a DOM check
9921 * @type string
9922 * @default <i>Empty string</i>
9932 * @type string
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
10012 * @type string
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>
10050 * @param {string} sSpecific The specific data type you want to get -
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
10074 * @type function|int|string|null
10084 * @type function|int|string|null
10108 * @type string
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
10118 * string - thus the calculation can go wrong (doing it properly and putting
10120 * a "work around" we provide this option. It will append its value to the
10121 * text that is found to be the longest string for the column - i.e. padding.
10122 * @type string
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
10130 * @type string
10137 * by index (needs a lookup to work by name).
10138 * @type string
10145 * @type string
10152 * @type string
10160 * @type string
10167 * @type string
10173 * @type string
10180 * @type string
10187 * @type string
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.
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').
10311 * is that you could have a column (visible or hidden) which the sorting
10332 * DataTables can be instructed to load data to display in the table from a
10338 * * `string` - Set the URL from where the data should be loaded from.
10342 * `string`
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
10402 * @type string|object|function
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
10516 * details about the way individual columns behave. For a full list of
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>
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
10642 * Replace a DataTable which matches the given selector and replace it with
10672 * will match a row containing those words, even if not in the order that was
10714 * Allows the end user to select the size of a formatted page from a select
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
10777 * that you understand this). `destroy` can be used to reinitialise a table if
10812 * However, this can look odd when filtering data down to a small data set,
10835 * `ajax` parameter must also be given in order to give DataTables a
10896 * cell that is found for a single column, or the bottom (false - default).
10917 * presented as a feature switch as it can increase processing time (while
10944 * `stateSaveCallback` to provide a storage solution such as cookies.
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
11041 * to have a comma separator for the 'thousands' units (e.g. 1 million is
11047 * @returns {string} formatted string for DataTables to show the number
11053 * // Format a number using a single quote for the separator (note that
11106 * be times where you wish to customise the string further. This callback
11115 * @param {string} pre The string that DataTables has formatted using it's
11117 * @returns {string} The string to be displayed in the information element.
11218 * For example you could use POST data, or pull information from a Gears or
11222 * @param {string} source HTTP source to obtain the data from (`ajax`)
11251 * this will be an empty array, for server-side processing there will be a
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.
11313 * a plug-in.
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.
11373 * but you might wish to use a server-side database or cookies.
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.
11423 * // Remove a saved filter, so filtering is never saved
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
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.
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
11594 * Note that the column header is prefixed to this string.
11595 * @type string
11617 * Note that the column header is prefixed to this string.
11618 * @type string
11639 * Pagination string used by DataTables for the built-in pagination
11648 * @type string
11671 * @type string
11694 * @type string
11717 * @type string
11738 * This string is shown in preference to `zeroRecords` when the table is
11742 * @type string
11761 * This string gives information to the end user about the information
11763 * used in the string and will be dynamically replaced as the table
11764 * display updates. This tokens can be placed anywhere in the string, or
11774 * @type string
11793 * Display information string for when the table is empty. Typically the
11794 * format of this string should match `info`.
11795 * @type string
11814 * When a user filters the information in a table, this string is appended
11817 * @type string
11836 * If can be useful to append extra information to the info string at times,
11840 * @type string
11841 * @default <i>Empty string</i>
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.
11870 * @type string
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
11894 * @type string
11915 * with a default select list of 10, 25, 50 and 100, and can be replaced
11916 * with a custom select box if required.
11917 * @type string
11959 * @type string
11978 * Text which is displayed when the table is processing a user action
11979 * (usually a sort command or similar).
11980 * @type string
11999 * filtering input text box. The variable "_INPUT_", if used in the string,
12001 * control over where it appears in the string. If "_INPUT_" is not given
12002 * then the input box is appended to the string automatically.
12003 * @type string
12033 * Assign a `placeholder` attribute to the search `input` element
12034 * @type string
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,
12050 * @type string
12051 * @default <i>Empty string - i.e. disabled</i>
12072 * @type string
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`
12123 * get a data source for multiple levels of nesting.
12124 * @type string
12142 * already have). Simply provide a url a JSON object can be obtained from.
12143 * @type string
12159 * table). DIV elements (with or without a custom class) can also be added to
12181 * <li>'&lt;"class" and '&gt;' - div with a class</li>
12192 * @type string
12212 * `dt-api search()`, providing a delay before the search is made.
12241 * @type string
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`
12265 * @type boolean|string
12266 * @default <i>blank string - i.e. disabled</i>
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
12289 * @type string
12290 * @default <i>blank string - i.e. disabled</i>
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).
12313 * @type string
12314 * @default <i>blank string - i.e. disabled</i>
12336 * @type string
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
12357 * @type string|object
12367 * Set the data property name that DataTables should use to get a row's id
12369 * @type string
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
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
12614 * including deeply nested objects / properties. `data` can be given in a
12619 * * `string` - read an object property from the data source. There are
12620 * three 'special' options that can be used in the string to alter how
12622 * * `.` - Dotted Javascript notation. Just as you use a `.` in
12625 * `browser.name`. If your object parameter name contains a period, use
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
12654 * * `{string}` The type call data requested - this will be 'set' when
12664 * Note that `data` is a getter and setter option. If you just require
12666 * is simply a getter and thus simpler to use.
12674 * @type string|int|function|null
12730 * // Using `data` as a function to provide different information for
12770 * // Using array notation - outputting a list from an array
12790 * this option can be given in a number of different ways to effect its
12795 * * `string` - read an object property from the data source. There are
12796 * three 'special' options that can be used in the string to alter how
12798 * * `.` - Dotted Javascript notation. Just as you use a `.` in
12801 * `browser.name`. If your object parameter name contains a period, use
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
12817 * defined using an integer, string or function using the same rules as
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
12826 * * {string} The type call data requested - this will be 'filter',
12834 * @type string|int|function|object|null
12841 * // Create a comma separated list from an array of objects
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).
12910 * @type string
12932 * @type string
12933 * @default <i>Empty string</i>
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
12969 * string - thus the calculation can go wrong (doing it properly and putting
12971 * a "work around" we provide this option. It will append its value to the
12972 * text that is found to be the longest string for the column - i.e. padding.
12974 * @type string
12975 * @default <i>Empty string<i>
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`
13002 * @type string
13048 * @type string
13049 * @default <i>Empty string</i>
13086 * Defines a data source type for the ordering which can be used to read
13090 * @type string
13129 * @type string
13165 * ordered. Four types (string, numeric, date and html (which will strip
13168 * date. For example: "Mar 26, 2008 5:03 PM". May take the values: 'string',
13171 * @type string
13207 * been given a specific width through this interface ensuring that the table
13209 * @type string
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}.
13411 * disabled if an empty string.
13413 * set a default use {@link DataTable.defaults}.
13414 * @type string
13422 * set a default use {@link DataTable.defaults}.
13423 * @type string
13430 * if an empty string.
13432 * set a default use {@link DataTable.defaults}.
13433 * @type string
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).
13703 * @type string
13704 * @default <i>Empty string</i>
13747 * set a default use {@link DataTable.defaults}.
13772 * set a default use {@link DataTable.defaults}.
13773 * @type string
13788 * set a default use {@link DataTable.defaults}.
13789 * @type string
13797 * set a default use {@link DataTable.defaults}.
13808 * and the JSON string to save that has been thus far created. Returns
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}.
13849 * @type string
13855 * Property from a given object from which to read the table data from. This
13856 * can be an empty string (when not server-side processing), in which case
13859 * set a default use {@link DataTable.defaults}.
13860 * @type string
13890 * set a default use {@link DataTable.defaults}.
13907 * set a default use {@link DataTable.defaults}.
13908 * @type string
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}.
14099 * @type string
14135 * Function used to get a row's id from the row's data
14142 * Data location where to store a row's id
14143 * @type string
14164 * This namespace acts as a collection area for plug-ins that can be used to
14198 * @type string
14207 * 'throw', 'none' or a function.
14209 * @type string|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.
14442 * than just the static string that DataTables knows of.
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
14504 * * `{string|null}` Data type detected, or null if unknown (and thus
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:
14555 * * `{string|null}` Formatted string that will be used for the searching.
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
14615 * "string-pre": function(x) {
14616 * a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
14617 * return parseFloat( a );
14622 * // Case-sensitive string ordering, with no pre-formatting method
14624 * "string-case-asc": function(x,y) {
14627 * "string-case-desc": function(x,y) {
14647 // The should not be used in new projects and will be removed in a future
14677 * @type string
14909 var tag = settings.oInit.pagingTag || 'a';
14922 'id': idx === 0 && typeof button === 'string' ?
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
15010 return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ?
15029 typeof data === 'string' ?
15036 string: function ( data ) {
15039 typeof data === 'string' ?
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+'';
15135 // string
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();
15148 // string-asc and -desc are retained only for compatibility with the old
15150 "string-asc": function ( x, y ) {
15154 "string-desc": function ( x, y ) {
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.
15248 return typeof d === 'string' ?
15257 // Common logic for moment, luxon or a date action
15282 dt = format && typeof d === 'string'
15308 // the output string for auto locale support
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
15468 * option to provide a display renderer. The following functions are defined:
15473 * * `string` - Thousands grouping separator
15474 * * `string` - Decimal point indicator
15476 * * `string` (optional) - Prefix.
15477 * * `string` (optional) - Postfix (/suffix).
15506 if ( typeof d !== 'number' && typeof d !== 'string' ) {
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