diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts
index d3fe178c3..d94d68864 100755
--- a/jquery.dataTables/jquery.dataTables-tests.ts
+++ b/jquery.dataTables/jquery.dataTables-tests.ts
@@ -3,1443 +3,890 @@
// http://www.datatables.net/api
-// $
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Highlight every second row
- oTable.$('tr:odd').css('backgroundColor', 'blue');
-} );
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Filter to rows with 'Webkit' in them, add a background colour and then
- // remove the filter, thus highlighting the 'Webkit' rows only.
- oTable.fnFilter('Webkit');
- oTable.$('tr', {"filter": "applied"}).css('backgroundColor', 'blue');
- oTable.fnFilter('');
-} );
-
-// _
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Get the data from the first row in the table
- var data = oTable._('tr:first');
-
- // Do something useful with the data
- alert( "First cell is: "+data[0] );
-} );
-
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Filter to 'Webkit' and get all data for
- oTable.fnFilter('Webkit');
- var data = oTable._('tr', {"filter": "applied"});
-
- // Do something with the data
- alert( data.length+" rows matched the filter" );
-} );
-
-// fnAddData
-
-var giCount = 2;
-
-$(document).ready(function() {
- $('#example').dataTable();
-} );
-
-function fnClickAddRow() {
- $('#example').dataTable().fnAddData( [
- giCount+".1",
- giCount+".2",
- giCount+".3",
- giCount+".4" ]
- );
-
- giCount++;
-}
-
-// fnAdjustColumnSizing
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable( {
- "sScrollY": "200px",
- "bPaginate": false
- } );
-
- $(window).bind('resize', function () {
- oTable.fnAdjustColumnSizing();
- } );
-} );
-
-// fnClearTable
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)
- oTable.fnClearTable();
-} );
-
-// fnClose
-
-$(document).ready(function() {
- var oTable;
-
- // 'open' an information row when a row is clicked on
- $('#example tbody tr').click( function () {
- if ( oTable.fnIsOpen(this) ) {
- oTable.fnClose( this );
- } else {
- oTable.fnOpen( this, "Temporary row opened", "info_row" );
- }
- } );
-
- oTable = $('#example').dataTable();
-} );
-
-// fnDeleteRow
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Immediately remove the first row
- oTable.fnDeleteRow( 0 );
-} );
-
-// fnDestroy
-
-$(document).ready(function() {
- // This example is fairly pointless in reality, but shows how fnDestroy can be used
- var oTable = $('#example').dataTable();
- oTable.fnDestroy();
-} );
-
-// fnDraw
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Re-draw the table - you wouldn't want to do it here, but it's an example :-)
- oTable.fnDraw();
-} );
-
-// fnFilter
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Sometime later - filter...
- oTable.fnFilter( 'test string' );
-} );
-
-// fnGetData
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- oTable.$('tr').click( function () {
- var data = oTable.fnGetData( this );
- // ... do something with the array / object of data for the row
- } );
-} );
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- oTable.$('td').click( function () {
- var sData = oTable.fnGetData( this );
- alert( 'The cell clicked on had the value of '+sData );
- } );
-} );
-
-// fnGetNodes
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Get the nodes from the table
- var nNodes = oTable.fnGetNodes( );
-} );
-
-// fnGetPosition
-
-$(document).ready(function() {
- $('#example tbody td').click( function () {
- // Get the position of the current data from the node
- var aPos = oTable.fnGetPosition( this );
-
- // Get the data array for this row
- var aData = oTable.fnGetData( aPos[0] );
-
- // Update the data array and return the value
- aData[ aPos[1] ] = 'clicked';
- this.innerHTML = 'clicked';
- } );
-
- // Init DataTables
- var oTable = $('#example').dataTable();
-} );
-
-// fnIsOpen
-
-$(document).ready(function() {
- var oTable;
-
- // 'open' an information row when a row is clicked on
- $('#example tbody tr').click( function () {
- if ( oTable.fnIsOpen(this) ) {
- oTable.fnClose( this );
- } else {
- oTable.fnOpen( this, "Temporary row opened", "info_row" );
- }
- } );
-
- oTable = $('#example').dataTable();
-} );
-
-// fnOpen
-
-$(document).ready(function() {
- var oTable;
-
- // 'open' an information row when a row is clicked on
- $('#example tbody tr').click( function () {
- if ( oTable.fnIsOpen(this) ) {
- oTable.fnClose( this );
- } else {
- oTable.fnOpen( this, "Temporary row opened", "info_row" );
- }
- } );
-
- oTable = $('#example').dataTable();
-} );
-
-// fnPageChange
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
- oTable.fnPageChange( 'next' );
-} );
-
-// fnSetColumnVis
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Hide the second column after initialisation
- oTable.fnSetColumnVis( 1, false );
-} );
-
-// fnSettings
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
- var oSettings = oTable.fnSettings();
-
- // Show an example parameter from the settings
- alert("" + oSettings._iDisplayStart);
-} );
-
-// fnSort
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Sort immediately with columns 0 and 1
- oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
-} );
-
-// fnSortListener
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
-
- // Sort on column 1, when 'sorter' is clicked on
- oTable.fnSortListener( document.getElementById('sorter'), 1 );
-} );
-
-// fnUpdate
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
- oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell
- oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1 ); // Row
-} );
-
-// fnVersionCheck
-
-$(document).ready(function() {
- var oTable = $('#example').dataTable();
- oTable.fnVersionCheck( '1.9.0');
-} );
-
-// http://datatables.net/usage/features
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bAutoWidth": false
- } );
-} );
-
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/arrays.txt",
- "bDeferRender": true
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bFilter": false
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bInfo": false
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bJQueryUI": true
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bLengthChange": false
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bPaginate": false
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bProcessing": true
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bScrollInfinite": true,
- "bScrollCollapse": true,
- "sScrollY": "200px"
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "xhr.php"
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bSort": false
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bSortClasses": false
- } );
-} );
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bStateSave": true
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sScrollX": "100%",
- "bScrollCollapse": true
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sScrollY": "200px",
- "bPaginate": false
- } );
-} );
-
-// http://datatables.net/usage/options
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sScrollY": "200px",
- "bPaginate": false
- } );
-
- // Some time later....
- $('#example').dataTable( {
- "bFilter": false,
- "bDestroy": true
- } );
-} );
-
-$(document).ready( function() {
- initTable();
- tableActions();
-} );
-
-function initTable ()
-{
- return $('#example').dataTable( {
- "sScrollY": "200px",
- "bPaginate": false,
- "bRetrieve": true
- } );
-}
-
-function tableActions ()
-{
- var oTable = initTable();
- // perform API operations with oTable
-}
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bScrollAutoCss": false,
- "sScrollY": "200px"
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sScrollY": "200",
- "bScrollCollapse": true
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bSortCellsTop": true
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "iCookieDuration": 60*60*24 // 1 day
- } );
-} );
-
-// 57 records available in the table, no filtering applied
-$(document).ready( function() {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "iDeferLoading": 57
- } );
-} );
-
-
-// 57 records after filtering, 100 without filtering (an initial filter applied)
-$(document).ready( function() {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "iDeferLoading": [ 57, 100 ],
- "oSearch": {
- "sSearch": "my_filter"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "iDisplayLength": 50
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "iDisplayStart": 20
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bScrollInfinite": true,
- "bScrollCollapse": true,
- "sScrollY": "200px",
- "iScrollLoadGap": 50
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "iTabIndex": 1
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oSearch": {"sSearch": "Initial search"}
- } );
-} )
-
-// Get data from { "data": [...] }
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/data.txt",
- "sAjaxDataProp": "data"
- } );
-} );
-
-
-// Get data from { "data": { "inner": [...] } }
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/data.txt",
- "sAjaxDataProp": "data.inner"
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php"
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sCookiePrefix": "my_datatable_"
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sDom": '<"top"i>rt<"bottom"flp><"clear">'
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sPaginationType": "full_numbers"
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sScrollX": "100%",
- "sScrollXInner": "110%"
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "scripts/post.php",
- "sServerMethod": "POST"
- } );
-} );
-
-// http://datatables.net/usage/callbacks
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "fnCookieCallback": function (sName, oData, sExpires, sPath) {
- // Customise oData or sName or whatever else here
- return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnCreatedRow": function( nRow, aData, iDataIndex ) {
- // Bold the grade for all 'A' grade browsers
- if ( aData[4] == "A" )
- {
- $('td:eq(4)', nRow).html( 'A' );
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnDrawCallback": function( oSettings ) {
- alert( 'DataTables has redrawn the table' );
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
- ( (nFoot.getElementsByTagName('th')[0])).innerHTML = "Starting index is "+iStart;
- }
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnFormatNumber": function ( iIn ) {
- if ( iIn < 1000 ) {
- return iIn.toString();
- } else {
- var
- s=(iIn+""),
- a=s.split(""), out="",
- iLen=s.length;
-
- for ( var i=0 ; i nHead.getElementsByTagName('th')[0]).innerHTML = "Displaying "+(iEnd-iStart)+" records";
- }
- } );
-} )
-
-$('#example').dataTable( {
- "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
- return iStart +" to "+ iEnd;
- }
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnInitComplete": function(oSettings, json) {
- alert( 'DataTables has finished its initialisation.' );
- }
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnPreDrawCallback": function( oSettings ) {
- if ( $('#test').val() == 1 ) {
- return false;
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
- // Bold the grade for all 'A' grade browsers
- if ( aData[4] == "A" )
- {
- $('td:eq(4)', nRow).html( 'A' );
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "xhr.php",
- "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
- oSettings.jqXHR = $.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "fnServerParams": function ( aoData ) {
- aoData.push( { "name": "more_data", "value": "my_value" } );
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateLoad": function (oSettings) {
- var o;
-
- // Send an Ajax request to the server to get the data. Note that
- // this is a synchronous request.
- $.ajax( {
- "url": "/state_load",
- "async": false,
- "dataType": "json",
- "success": function (json) {
- o = json;
- }
- } );
-
- return o;
- }
- } );
-} );
-
-// Remove a saved filter, so filtering is never loaded
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateLoadParams": function (oSettings, oData) {
- oData.oSearch.sSearch = "";
- }
- } );
-} );
-
-
-// Disallow state loading by returning false
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateLoadParams": function (oSettings, oData) {
- return false;
- }
- } );
-} );
-
-// Show an alert with the filtering value that was saved
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateLoaded": function (oSettings, oData) {
- alert( 'Saved filter was: '+oData.oSearch.sSearch );
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateSave": function (oSettings, oData) {
- // Send an Ajax request to the server with the state object
- $.ajax( {
- "url": "/state_save",
- "data": oData,
- "dataType": "json",
- "method": "POST",
- "success": function () {}
- } );
- }
- } );
-} );
-
-// Remove a saved filter, so filtering is never saved
-$(document).ready( function() {
- $('#example').dataTable( {
- "bStateSave": true,
- "fnStateSaveParams": function (oSettings, oData) {
- oData.oSearch.sSearch = "";
- }
- } );
-} );
-
-// http://datatables.net/usage/columns
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "aDataSort": [ 0, 1 ], "aTargets": [ 0 ] },
- { "aDataSort": [ 1, 0 ], "aTargets": [ 1 ] },
- { "aDataSort": [ 2, 3, 4 ], "aTargets": [ 2 ] }
- ]
- } );
-} );
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "aDataSort": [ 0, 1 ] },
- { "aDataSort": [ 1, 0 ] },
- { "aDataSort": [ 2, 3, 4 ] },
- null,
- null
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "asSorting": [ "asc" ], "aTargets": [ 1 ] },
- { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 2 ] },
- { "asSorting": [ "desc" ], "aTargets": [ 3 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- null,
- { "asSorting": [ "asc" ] },
- { "asSorting": [ "desc", "asc", "asc" ] },
- { "asSorting": [ "desc" ] },
- null
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "bSearchable": false, "aTargets": [ 0 ] }
- ] } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "bSearchable": false },
- null,
- null,
- null,
- null
- ] } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "bSortable": false, "aTargets": [ 0 ] }
- ] } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "bSortable": false },
- null,
- null,
- null,
- null
- ] } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "bVisible": false, "aTargets": [ 0 ] }
- ] } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "bVisible": false },
- null,
- null,
- null,
- null
- ] } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [ {
- "aTargets": [3],
- "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
- if ( sData == "1.7" ) {
- $(nTd).css('color', 'blue')
- }
- }
- } ]
- });
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "iDataSort": 1, "aTargets": [ 0 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "iDataSort": 1 },
- null,
- null,
- null,
- null
- ]
- } );
-} );
-
-// Read table data from objects
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/deep.txt",
- "aoColumns": [
- { "mData": "engine" },
- { "mData": "browser" },
- { "mData": "platform.inner" },
- { "mData": "platform.details.0" },
- { "mData": "platform.details.1" }
- ]
- } );
-} );
-
-
-// Using mData as a function to provide different information for
-// sorting, filtering and display. In this case, currency (price)
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "aoColumnDefs": [ {
- "aTargets": [ 0 ],
- "mData": function ( source, type, val ) {
- if (type === 'set') {
- source.price = val;
- // Store the computed dislay and filter values for efficiency
- source.price_display = val=="" ? "" : "$"+val;
- source.price_filter = val=="" ? "" : "$"+val+" "+val;
- return;
- }
- else if (type === 'display') {
- return source.price_display;
- }
- else if (type === 'filter') {
- return source.price_filter;
- }
- // 'sort', 'type' and undefined all just use the integer
- return source.price;
- }
- } ]
- } );
-} );
-
-// Create a comma separated list from an array of objects
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/deep.txt",
- "aoColumns": [
- { "mData": "engine" },
- { "mData": "browser" },
- {
- "mData": "platform",
- "mRender": "[, ].name"
- }
- ]
- } );
-} );
-
-
-// Use as a function to create a link from the data source
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "aoColumnDefs": [ {
- "aTargets": [ 0 ],
- "mData": "download_link",
- "mRender": function ( data, type, full ) {
- return 'Download';
- }
- } ]
- } );
-} );
-
-// Make the first column use TH cells
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "aoColumnDefs": [ {
- "aTargets": [ 0 ],
- "sCellType": "th"
- } ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sClass": "my_class", "aTargets": [ 0 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "sClass": "my_class" },
- null,
- null,
- null,
- null
- ]
- } );
-} );
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- null,
- null,
- null,
- {
- "sContentPadding": "mmm"
- }
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- {
- "mData": null,
- "sDefaultContent": "Edit",
- "aTargets": [ -1 ]
- }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- null,
- null,
- null,
- {
- "mData": null,
- "sDefaultContent": "Edit"
- }
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sName": "engine", "aTargets": [ 0 ] },
- { "sName": "browser", "aTargets": [ 1 ] },
- { "sName": "platform", "aTargets": [ 2 ] },
- { "sName": "version", "aTargets": [ 3 ] },
- { "sName": "grade", "aTargets": [ 4 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "sName": "engine" },
- { "sName": "browser" },
- { "sName": "platform" },
- { "sName": "version" },
- { "sName": "grade" }
- ]
- } );
-} );
-
-/*
-
-This test does not compile, because - for some hard to find reason - the compiler is missing the aTargets
-property of the second element.
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sSortDataType": "dom-text", "aTargets": [ 2, 3 ] },
- { "sType": "numeric", "aTargets": [ 3 ] },
- { "sSortDataType": "dom-select", "aTargets": [ 4 ] },
- { "sSortDataType": "dom-checkbox", "aTargets": [ 5 ] }
- ]
- } );
-} );
-
-*/
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- null,
- null,
- { "sSortDataType": "dom-text" },
- { "sSortDataType": "dom-text", "sType": "numeric" },
- { "sSortDataType": "dom-select" },
- { "sSortDataType": "dom-checkbox" }
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sTitle": "My column title", "aTargets": [ 0 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "sTitle": "My column title" },
- null,
- null,
- null,
- null
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sType": "html", "aTargets": [ 0 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "sType": "html" },
- null,
- null,
- null,
- null
- ]
- } );
-} );
-
-// Using aoColumnDefs
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumnDefs": [
- { "sWidth": "20%", "aTargets": [ 0 ] }
- ]
- } );
-} );
-
-
-// Using aoColumns
-$(document).ready( function() {
- $('#example').dataTable( {
- "aoColumns": [
- { "sWidth": "20%" },
- null,
- null,
- null,
- null
- ]
- } );
-} );
-
-// http://www.datatables.net/usage/i18n
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oAria": {
- "sSortAscending": " - click/return to sort ascending"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oAria": {
- "sSortDescending": " - click/return to sort descending"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oPaginate": {
- "sFirst": "First page"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oPaginate": {
- "sLast": "Last page"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oPaginate": {
- "sNext": "Next page"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "oPaginate": {
- "sPrevious": "Previous page"
- }
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sEmptyTable": "No data available in table"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sInfoEmpty": "No entries to show"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sInfoFiltered": " - filtering from _MAX_ records"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sInfoPostFix": "All records shown are derived from real information."
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sInfoThousands": "'"
- }
- } );
-} );
-
-// Language change only
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sLengthMenu": "Display _MENU_ records"
- }
- } );
-} );
-
-
-// Language and options change
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sLengthMenu": 'Display records'
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sLoadingRecords": "Please wait - loading..."
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sProcessing": "DataTables is currently busy"
- }
- } );
-} );
-
-// Input text box will be appended at the end automatically
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sSearch": "Filter records:"
- }
- } );
-} );
-
-
-// Specify where the filter should appear
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sSearch": "Apply filter _INPUT_ to table"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt"
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "oLanguage": {
- "sZeroRecords": "No records to display"
- }
- } );
-} );
-
-// http://www.datatables.net/usage/server-side
-
-$(document).ready( function () {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "xhr.php"
- } );
-} );
-
-// POST data to server
-$(document).ready( function() {
- $('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "xhr.php",
- "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
- oSettings.jqXHR = $.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "fnServerParams": function ( aoData ) {
- aoData.push( { "name": "more_data", "value": "my_value" } );
- }
- } );
-} );
-
-// Get data from { "data": [...] }
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/data.txt",
- "sAjaxDataProp": "data"
- } );
-} );
-
-
-// Get data from { "data": { "inner": [...] } }
-$(document).ready( function() {
- var oTable = $('#example').dataTable( {
- "sAjaxSource": "sources/data.txt",
- "sAjaxDataProp": "data.inner"
- } );
-} );
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php"
- } );
-} )
-
-$(document).ready( function() {
- $('#example').dataTable( {
- "bServerSide": true,
- "sAjaxSource": "scripts/post.php",
- "sServerMethod": "POST"
- } );
-} );
+$(document).ready(function () {
+ //#region "Language"
+
+ var lang: DataTables.LanguageSettings = {
+ "emptyTable": "No data available in table",
+ "info": "Showing _START_ to _END_ of _TOTAL_ entries",
+ "infoEmpty": "Showing 0 to 0 of 0 entries",
+ "infoFiltered": "(filtered from _MAX_ total entries)",
+ "infoPostFix": "",
+ "thousands": ",",
+ "lengthMenu": "Show _MENU_ entries",
+ "loadingRecords": "Loading...",
+ "processing": "Processing...",
+ "search": "Search:",
+ "zeroRecords": "No matching records found",
+ "paginate": {
+ "first": "First",
+ "last": "Last",
+ "next": "Next",
+ "previous": "Previous"
+ },
+ "aria": {
+ "sortAscending": ": activate to sort column ascending",
+ "sortDescending": ": activate to sort column descending"
+ }
+ };
+
+ //#endregion "Language"
+
+ //#region "Column"
+
+ var colCreatedCellFunc: DataTables.IFunctionColumnCreatedCell = function (cell, cellData, rowData, rowIndex, colIndex) {
+
+ }
+
+ var colDataObject: DataTables.IObjectColumnData = {
+ _: "phone",
+ filter: "phone_filter",
+ display: "phone_display",
+ sort: "asc"
+ };
+
+ var colDataFunc: DataTables.IFunctionColumnData = function (row, type, set, meta) {
+ };
+
+ var colRenderObject: DataTables.IObjectColumnRender = {
+ _: "phone",
+ filter: "phone_filter",
+ display: "phone_display",
+ sort: "asc"
+ };
+
+ var colRenderFunc: DataTables.IFunctionColumnRender = function (data, type, row, meta) {
+
+ };
+
+ var col: DataTables.ColumnSettings =
+ {
+ cellType: "th",
+ className: "css",
+ contentPadding: "mmmm",
+ createdCell: colCreatedCellFunc,
+ data: 1,
+ defaultContent: "edit",
+ name: "name",
+ orderable: true,
+ orderData: 10,
+ orderDataType: "dom-checkbox",
+ orderSequence: ['asc', 'desc'],
+ render: 1,
+ searchable: true,
+ title: "title",
+ visible: true,
+ width: "200px"
+ }
+ col =
+ {
+ data: "",
+ orderData: [10, 11, 20],
+ render: "",
+ }
+ col =
+ {
+ data: colDataObject,
+ render: colRenderObject,
+ }
+ col =
+ {
+ data: colDataFunc,
+ render: colRenderFunc,
+ }
+
+ //#endregion "Column"
+
+ //#region "ColumnDef"
+
+ var colDef: DataTables.ColumnDefsSettings =
+ {
+ targets: 1,
+ cellType: "th",
+ className: "css",
+ contentPadding: "mmmm",
+ createdCell: colCreatedCellFunc,
+ data: 1,
+ defaultContent: "edit",
+ name: "name",
+ orderable: true,
+ orderData: 10,
+ orderDataType: "dom-checkbox",
+ orderSequence: ['asc', 'desc'],
+ render: 1,
+ searchable: true,
+ title: "title",
+ visible: true,
+ width: "200px"
+ };
+
+ colDef =
+ {
+ targets: "2",
+ cellType: "th",
+ };
+
+ colDef =
+ {
+ targets: ["2", 5],
+ cellType: "th",
+ };
+
+ //#endregion "ColumnDef"
+
+ //#region "Callbacks"
+
+ var createRowFunc: DataTables.IFunctionCreateRow = function (row, data, dataIndex) { };
+ var drawCallbackFunc: DataTables.IFunctionDrawCallback = function (settings) { };
+ var footerCallbackFunc: DataTables.IFunctionFooterCallback = function (tfoot, data, start, end, display) { };
+ var formatNumberFunc: DataTables.IFunctionFormatNumber = function (toForm) { };
+ var headerCallbackFunc: DataTables.IFunctionHeaderCallback = function (thead, data, start, end, display) { };
+ var infoCallbackFunc: DataTables.IFunctionInfoCallback = function (settings, start, end, total, pre) { };
+ var initCallbackFunc: DataTables.IFunctionInitComplete = function (settings, json) { };
+ var preDrawFunc: DataTables.IFunctionPreDrawCallback = function (settings) { };
+ var rowCallbackFunc: DataTables.IFunctionRowCallback = function (row, data) { };
+ var stateLoadCallbackFunc: DataTables.IFunctionStateLoadCallback = function (settings) { };
+ var stateLoadedCallbackFunc: DataTables.IFunctionStateLoaded = function (settings, data) { };
+ var stateSaveCallbackFunc: DataTables.IFunctionStateSaveCallback = function (settings, data) { };
+ var stateSaveParamsFunc: DataTables.IFunctionStateSaveParams = function (settings, data) { };
+
+ //#endregion "Callbacks
+
+ //#region "Ajax"
+
+ var ajaxFunc: DataTables.IFunctionAjax = function (data, callback, settings) { };
+
+ var ajaxDataFunc: DataTables.IFunctionAjaxData = function (data) {
+ return data;
+ };
+
+ ajaxDataFunc = function (data) {
+ return "";
+ };
+
+ //#endregion "Ajax"
+
+ //#region "Settings"
+
+ var config: DataTables.Settings =
+ {
+ // columns
+ columns: [
+ col,
+ null,
+ col,
+ null,
+ col,
+ col
+ ],
+ columnDefs: [
+ null,
+ colDef,
+ colDef,
+ null,
+ ],
+ // Data
+ ajax: "url",
+ data: {},
+ // Features
+ autoWidth: true,
+ deferRender: true,
+ info: true,
+ jQueryUI: false,
+ lengthChange: true,
+ ordering: true,
+ paging: true,
+ scrollX: true,
+ scrollY: "200px",
+ searching: true,
+ serverSide: true,
+ stateSave: true,
+ // Options
+ deferLoading: 10,
+ destroy: true,
+ displayStart: 1,
+ dom: "lrtip",
+ lengthMenu: [1, 2, 3, 4],
+ orderCellsTop: true,
+ orderClasses: true,
+ order: [[0, 'asc'], [1, 'asc']],
+ orderFixed: [[0, 'asc'], [1, 'asc']],
+ orderMulti: true,
+ pageLength: 10,
+ pagingType: "simple",
+ retrieve: true,
+ renderer: "bootstrap",
+ scrollCollapse: true,
+ search: true,
+ searchCols: [{ "search": "", "smart": true, "regex": false, "caseInsensitive": true }],
+ searchDelay: 10,
+ stateDuration: 10,
+ tabIndex: 10,
+ };
+
+
+ config =
+ {
+ ajax: ajaxFunc,
+ deferLoading: [10, 100],
+ lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
+ order: [0, 'asc'],
+ orderFixed: [[0, 'asc'], [1, 'asc']],
+ renderer: {
+ header: "bootstrap",
+ pageButton: "jqueryui"
+ },
+ search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
+ searchCols: [
+ null,
+ { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
+ { "search": "" },
+ { "search": "", "smart": true },
+ null
+ ],
+ };
+
+ config =
+ {
+ ajax: {
+ data: {},
+ dataSrc: "",
+ },
+ };
+
+ config =
+ {
+ ajax: {
+ data: ajaxDataFunc,
+ dataSrc: function (data) { },
+ },
+ };
+
+ //#endregion "Settings"
+
+ //#region "Init"
+
+ var dt = $('#example').DataTable();
+ dt = $('#example1').DataTable(config);
+ dt = $('#example1').DataTable(config);
+ dt.$('tr:odd').css('backgroundColor', 'blue');
+
+ //#endregion "Init"
+
+ //#region "Methods-Ajax"
+
+ var json = dt.ajax.json();
+
+ var params = dt.ajax.params();
+
+ var reload = dt.ajax.reload();
+ reload = dt.ajax.reload(function () { });
+ reload = dt.ajax.reload(function () { }, true);
+ var test = reload.$("");
+
+ var url = dt.ajax.url();
+ dt.ajax.url("url");
+ dt.ajax.url("url").load();
+
+ //#endregion "Methods-Ajax"
+
+ //#region "Methods-Core"
+
+ var clear = dt.clear();
+ clear.$("");
+
+ var data = dt.data();
+ data.$("");
+
+ var destroy = dt.destroy();
+ destroy = dt.destroy(true);
+ destroy.$("");
+
+ var draw = dt.draw();
+ draw = dt.draw(true);
+ draw.$("");
+
+ var off = dt.off("event");
+ off = dt.off("event", function () { });
+ off.$("");
+
+ var on = dt.on("event", function () { });
+ on.$("");
+
+ var one = dt.one("event", function () { });
+ one.$("");
+
+ var order_get = dt.order();
+ var order_set = dt.order([0, "asc"]);
+ order_set = dt.order([0, "asc"], [1, "desc"]); // TODO: Fíx that
+ order_set = dt.order([[0, "asc"], [1, "desc"]]);
+
+ var orderListerner = order_set.order.listener("node", 1, function () { });
+
+ var page_get = dt.page();
+ var page_set = dt.page(1);
+ page_set = dt.page("next");
+
+ var page = dt.page.info();
+ page = {
+ "page": 1,
+ "pages": 6,
+ "start": 10,
+ "end": 20,
+ "length": 10,
+ "recordsTotal": 57,
+ "recordsDisplay": 57
+ };
+
+ var page_len_get = dt.page.len();
+ var page_len_set = dt.page.len(10);
+
+ var search_get = dt.search();
+ var search_set = dt.search("searchStr");
+ search_set = dt.search("searchStr", true);
+ search_set = dt.search("searchStr", true, false);
+ search_set = dt.search("searchStr", true, false, false);
+
+ var settings = dt.settings();
+
+ var state = dt.state();
+ state = { "time": 1423772610230, "start": 0, "length": 25, "order": [[0, "asc"]], "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, "columns": [{ "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }] };
+ state = dt.state.loaded();
+
+ var state_clear = dt.state.clear();
+ state_clear.$("");
+
+ var state_save = dt.state.save();
+ state_save.$("");
+
+ //#endregion "Methods-Core"
+
+ var modifier: DataTables.IObjectSelectorModifier = {
+ order: "current",
+ search: "none",
+ page: "all",
+ };
+
+ //#region "Methods-Cell"
+
+ var cells = dt.cells();
+ cells = dt.cells(":contains('Not shipped')");
+ cells = dt.cells(function () { });
+ cells = dt.cells($(""));
+ cells = dt.cells({});
+ cells = dt.cells(":contains('Not shipped')r", modifier);
+ cells = dt.cells("row-selector", "cells-selector", modifier);
+
+ var cells_cache = cells.cache("search");
+ // Create the select list and search operation
+ var select = $('')
+ .appendTo('body')
+ .on('change', function () {
+ dt
+ .column(0)
+ .search($(this).val())
+ .draw();
+ });
+ // Get the search data for the first column and add to the select list
+ var data = dt
+ .cells('', 0)
+ .cache('search')
+ .sort()
+ .unique()
+ .each(function (d) {
+ select.append($(''));
+ });
+
+ var cells_data = cells.data();
+ var data = dt
+ .cells(".info")
+ .data();
+
+ console.log(data);
+
+ var cells_indexes = cells.indexes();
+ var columns_d = dt
+ .cells(':contains("21")')
+ .indexes()
+ .pluck('column')
+ .sort()
+ .unique();
+
+ alert('Columns containing 21: ' + columns_d.join(', '));
+
+ var cells_invalidate = cells.invalidate();
+ var cells_invalidate = cells.invalidate("data");
+ var td = $('#example tbody td:eq(0)');
+ td.html('Updated');
+ dt.cell(td).invalidate().draw();
+
+ var cells_nodes = cells.nodes();
+ var cells_d = dt
+ .cells(":contains('Not shipped')")
+ .nodes();
+
+ $(cells_d).addClass('warning');
+
+ var cells_render = cells.render("display");
+ $('#example').on('click', 'tbody td', function () {
+ var idx = dt.cell(this).index().row;
+ var data = dt.cells(idx, '').render('display');
+
+ console.log(data);
+ });
+
+ var cell = dt.cell(":contains('Not shipped')");
+ cell = dt.cell(function () { });
+ cell = dt.cell($(""));
+ cell = dt.cell({});
+ cell = dt.cell(":contains('Not shipped')r", modifier);
+ cell = dt.cell("row-selector", "cells-selector", modifier);
+
+ var cell_cache = cell.cache("search");
+ $('#example tbody').on('click', 'td', function () {
+ alert(dt.cell(this).cache('order'));
+ });
+
+ var cell_data_get = cell.data();
+ $('#example tbody').on('click', 'td', function () {
+ alert(dt.cell(this).data());
+ });
+
+ var cell_data_set = cell.data("string");
+ cell_data_set = cell.data(1);
+ $('#example tbody').on('click', 'td', function () {
+ var cell = dt.cell(this);
+ cell.data(cell.data() + 1).draw();
+ });
+
+ var cell_index = cell.index();
+ $('#example tbody').on('click', 'td', function () {
+ alert('Clicked on cell in visible column: ' + dt.cell(this).index().columnVisible);
+ });
+ $('#example tbody').on('click', 'td', function () {
+ var rowIdx = dt
+ .cell(this)
+ .index().row;
+
+ dt.rows(rowIdx)
+ .nodes()
+ .to$()
+ .addClass('clicked');
+ });
+
+ var cell_invalidate = cell.invalidate();
+ var cell_invalidate = cell.invalidate("data");
+ $('#example tbody').on('click', 'td', function () {
+ this.innerHTML = parseInt(this.innerHTML) + 1;
+ dt.cell(this).invalidate().draw();
+ });
+
+ var cell_nodes = cell.node();
+ var cell_n = dt
+ .cell("#importantCell")
+ .node();
+
+ $(cell_n).addClass('warning');
+
+ var cell_render = cell.render("display");
+ $('#example').on('click', 'tbody td', function () {
+ var data = dt.cell(this).render('display');
+
+ console.log(data);
+ });
+ $('#example').on('click', 'tbody td', function () {
+ var data = dt.cell(this).render('sort');
+
+ console.log(data);
+ });
+
+ //#endregion "Methods-Cell"
+
+ //#region "Methods-Column"
+
+ var columns = dt.columns();
+ columns = dt.columns("selector");
+ columns = dt.columns("selector", modifier);
+
+ var columns_cache = columns.cache("order");
+ dt.columns('.select-filter').eq(0).each(function (colIdx) {
+ // Create the select list and search operation
+ var select = $('')
+ .appendTo(
+ dt.column(colIdx).footer()
+ )
+ .on('change', function () {
+ dt
+ .column(colIdx)
+ .search($(this).val())
+ .draw();
+ });
+
+ // Get the search data for the first column and add to the select list
+ dt
+ .column(colIdx)
+ .cache('search')
+ .sort()
+ .unique()
+ .each(function (d) {
+ select.append($(''));
+ });
+ });
+
+ var columns_data = columns.data();
+ //$('#listData').html(
+ // dt
+ // .columns(0)
+ // .data()
+ // .eq(0) // Reduce the 2D array into a 1D array of data
+ // .sort() // Sort data alphabetically
+ // .unique() // Reduce to unique values
+ // .join('
')
+ // );
+
+ //var idx = dt
+ // .columns('.check')
+ // .data()
+ // .eq(0) // Reduce the 2D array into a 1D array of data
+ // .indexOf('Yes');
+
+ var columns_dataSrc = columns.dataSrc();
+ //alert('Data source: ' + dt.columns([0, 1]).dataSrc().join(' '));
+
+ var columns_footer = columns.footer();
+ var columns_header = columns.header();
+ var columns_indexes = columns.indexes();
+ columns_indexes = columns.indexes("visibile");
+ var columns_nodes = columns.nodes();
+ dt
+ .columns('.ready')
+ .nodes()
+ //.flatten() // Reduce to a 1D array
+ //.to$() // Convert to a jQuery object
+ //.addClass('highlight');
+
+ var columns_search_get = columns.search();
+ var columns_search_set = columns.search("string");
+ columns_search_set = columns.search("string", true);
+ columns_search_set = columns.search("string", true, false);
+ columns_search_set = columns.search("string", true, false, true);
+
+ var columns_visible_get = columns.visible();
+ var columns_visible_set = columns.visible(false);
+ columns_visible_set = columns.visible(false, true);
+ // Hide a column
+ dt.column(1).visible(false);
+ dt.columns([0, 1, 2, 3]).visible(false, false);
+ dt.columns.adjust().draw(false); // adjust column sizing and redraw
+
+ var columns_adjust = dt.columns.adjust();
+
+ var column = dt.column("selector");
+ column = dt.column("selector", modifier);
+
+ dt.column(0).visible(false);
+
+ $('#example tbody').on('click', 'td', function () {
+ var visIdx = $(this).index();
+ var dataIdx = dt.column.index('fromVisible', visIdx);
+
+ alert('Column data index: ' + dataIdx + ', and visible index: ' + visIdx);
+ });
+
+ var column_cache = column.cache("order");
+ // Create the select list and search operation
+ var select = $('')
+ .appendTo(
+ dt.column(0).footer()
+ )
+ .on('change', function () {
+ dt
+ .column(0)
+ .search($(this).val())
+ .draw();
+ });
+
+ // Get the search data for the first column and add to the select list
+ dt
+ .column(0)
+ .cache('search')
+ // .sort()
+ // .unique()
+ // .each(function (d) {
+ // select.append($(''));
+ //});
+
+ var column_data = column.data();
+ alert('Column 4 sum: ' +
+ dt
+ .column(4)
+ .data()
+ //.reduce(function (a, b) {
+ //return a + b;
+ //})
+ );
+
+ var column_dataSrc = column.dataSrc();
+ $('#example').on('click', 'tbody td', function () {
+ var idx = dt.cell(this).index().column;
+ alert('Data source: ' + dt.column(idx).dataSrc());
+ });
+
+ var column_footer = column.footer();
+ //var column_p = dt.column(0);
+ //$(column.footer()).html(
+ // column_p
+ // .data()
+ // .reduce(function (a, b) {
+ // return a + b;
+ // })
+ // );
+
+ var column_header = column.header();
+ $('#example tbody').on('click', 'td', function () {
+ var idx = dt.cell(this).index().column;
+ var title = dt.column(idx).header();
+
+ alert('Column title clicked on: ' + $(title).html());
+ });
+
+ var column_index = column.index();
+ column_index = column.index("visibile");
+ dt.column(0).visible(false);
+
+ var idx = dt.column(1).index('visible');
+ alert(idx); // will show 0
+
+ dt.column('0:visible').order('asc');
+
+ var column_nodes = column.nodes();
+ dt.column(-1)
+ .nodes()
+ //.to$() // Convert to a jQuery object
+ //.addClass('ready');
+
+ var column_search_get = column.search();
+ var column_search_set = column.search("string");
+ column_search_set = column.search("string", true);
+ column_search_set = column.search("string", true, false);
+ column_search_set = column.search("string", true, false, true);
+ $('#column3_search').on('keyup', function () {
+ dt
+ .columns(3)
+ .search(this.value)
+ .draw();
+ });
+
+ //dt.columns('.select-filter').eq(0).each(function (colIdx) {
+ // // Create the select list and search operation
+ // var select = $('')
+ // .appendTo(
+ // dt.column(colIdx).footer()
+ // )
+ // .on('change', function () {
+ // dt
+ // .column(colIdx)
+ // .search($(this).val())
+ // .draw();
+ // });
+
+ // // Get the search data for the first column and add to the select list
+ // dt
+ // .column(colIdx)
+ // .cache('search')
+ // .sort()
+ // .unique()
+ // .each(function (d) {
+ // select.append($(''));
+ // });
+ //});
+
+ var column_visible_get = column.visible();
+ var column_visible_set = column.visible(false);
+ column_visible_set = column.visible(false, true);
+ alert('Column index 0 is ' +
+ (dt.column(0).visible() === true ? 'visible' : 'not visible')
+ );
+ for (var i = 0; i < 4; i++) {
+ dt.column(i).visible(false, false);
+ }
+ dt.columns.adjust().draw(false); // adjust column sizing and redraw
+
+ //#endregion "Methods-Column"
+
+ //#region "Methods-Row"
+
+ var row_1 = dt.row("selector");
+ var row_2 = dt.row("selector").child.hide();
+ var row_3 = dt.row("selector").child.isShown();
+ var row_4 = dt.row("selector").child.remove();
+ var row_5 = dt.row("selector").child.show();
+ var row_6 = dt.row("selector").child();
+ var row_7 = dt.row("selector").child(false);
+ var row_8 = dt.row("selector").child(false).hide();
+ var row_9 = dt.row("selector").child("data");
+ var row_10 = dt.row("selector").child("data").remove();
+ var row_11 = dt.row("selector").child("data", "css").show();
+ var row_12 = dt.row("selector").child.remove();
+ var row_13 = dt.row("selector").child.show();
+ var row_14 = dt.row.add({});
+ var row_15 = dt.row("selector").invalidate();
+ var row_16 = dt.row("selector").invalidate("auto");
+ var row_17 = dt.row("selector").data();
+ var row_18 = dt.row("selector").data({});
+ var row_19 = dt.row("selector").index();
+ var row_20 = dt.row("selector").node();
+ var row_21 = dt.row("selector").remove();
+
+ var rows_1 = dt.rows();
+ var rows_2 = dt.rows().remove();
+ var rows_3 = dt.rows("selector");
+ var rows_4 = dt.rows("selector").cache("type");
+ var rows_5 = dt.rows("selector").data();
+ var rows_6 = dt.rows("selector").data({});
+ var rows_7 = dt.rows("selector").indexes();
+ var rows_8 = dt.rows("selector").invalidate();
+ var rows_9 = dt.rows("selector").invalidate("auto");
+ var rows_10 = dt.rows("selector").indexes();
+ var rows_11 = dt.rows("selector").remove();
+ var rows_12 = dt.rows("selector").nodes();
+ var rows_13 = dt.rows.add([{}, {}]);
+
+ var table3 = $('#example').DataTable();
+ table3.row.add({
+ "name": "Tiger Nixon",
+ "position": "System Architect",
+ "salary": "$3,120",
+ "start_date": "2011/04/25",
+ "office": "Edinburgh",
+ "extn": "5421"
+ }).draw();
+
+ var table4 = $('#example').DataTable();
+ table4.row.add([{
+ "name": "Tiger Nixon",
+ "position": "System Architect",
+ "salary": "$3,120",
+ "start_date": "2011/04/25",
+ "office": "Edinburgh",
+ "extn": "5421"
+ }, {
+ "name": "Garrett Winters",
+ "position": "Director",
+ "salary": "$5,300",
+ "start_date": "2011/07/25",
+ "office": "Edinburgh",
+ "extn": "8422"
+ }])
+ .draw();
+
+ var pupil: any;
+ var table5 = $('#example').DataTable();
+ table5.rows.add([
+ pupil,
+ pupil,
+ pupil,
+ ])
+ .draw();
+ //.nodes()
+ //.to$()
+ //.addClass('new');
+
+ $('#example tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).parents('tr');
+ var row = dt.row(tr);
+
+ if (row.child.isShown()) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row (the format() function would return the data to be shown)
+ row.child("").show();
+ tr.addClass('shown');
+ }
+ });
+
+ dt.row(':eq(0)').child([
+ 'First child row',
+ 'Second child row',
+ 'Third child row'
+ ])
+ .show();
+
+ dt.rows().eq(0).each(function (rowIdx) {
+ dt
+ .row(rowIdx)
+ .child(
+ $(
+ '' +
+ '| ' + rowIdx + '.1 | ' +
+ '' + rowIdx + '.2 | ' +
+ '' + rowIdx + '.3 | ' +
+ '' + rowIdx + '.4 | ' +
+ '
'
+ )
+ )
+ .show();
+ });
+
+ $('#example tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).parents('tr');
+ var row = dt.row(tr);
+
+ if (row.child.isShown()) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row (the format() function would return the data to be shown)
+ row.child("").show();
+ tr.addClass('shown');
+ }
+ });
+
+ $('#example tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).parents('tr');
+ var row = dt.row(tr);
+
+ if (row.child.isShown()) {
+ // This row is already open - remove it
+ row.child.remove();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row (the format() function would return the data to be shown)
+ row.child("").show();
+ tr.addClass('shown');
+ }
+ });
+
+ //#endregion "Methods-Row"
+
+ //#region "Methods-Table"
+
+ var tables = dt.tables();
+ tables = dt.tables("selector");
+
+ var tables_body = tables.body();
+ var tables_containers = tables.containers();
+ var tables_footer = tables.footer();
+ var tables_header = tables.header();
+ var tables_nodes = tables.nodes();
+
+ var table = dt.table("selector");
+
+ var table_body = table.body();
+ var table_container = table.container();
+ var table_footer = table.footer();
+ var table_header = table.header();
+ var table_node = table.node();
+
+ //#endregion "Methods-Table"
+
+ //#region "Methods-Util"
+
+ //#endregion "Methods-Util"
+});
diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts
index 9884b78e2..23087fbb7 100755
--- a/jquery.dataTables/jquery.dataTables.d.ts
+++ b/jquery.dataTables/jquery.dataTables.d.ts
@@ -1,479 +1,1602 @@
-// Type definitions for JQuery DataTables 1.9.4
+// Type definitions for JQuery DataTables 1.10.5
// Project: http://www.datatables.net
-// Definitions by: Armin Sander
+// Definitions by: Kiarash Ghiaseddin
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// missing:
// - Static methods that are defined in JQueryStatic.fn are not typed.
// - Plugin and extension definitions are not typed.
+// - Some return types are not fully wokring
-interface JQuery
-{
- dataTable(param? :DataTables.Options) : DataTables.DataTable;
+interface JQuery {
+ DataTable(param?: DataTables.Settings): DataTables.DataTable;
}
-declare module DataTables
-{
- export interface DataTable
- {
- /// Perform a jQuery selector action on the table's TR elements (from the tbody) and return the resulting jQuery object.
- $(selector:string, opts?:RowParams): JQuery;
- $(selector:Node[], opts?:RowParams): JQuery;
- $(selector:JQuery, opts?:RowParams): JQuery;
-
- /// Almost identical to $ in operation, but in this case returns the data for the matched rows.
- _(selector:string, opts?:RowParams): any[];
- _(selector:Node[], opts?:RowParams): any[];
- _(selector:JQuery, opts?:RowParams): any[];
-
- /// Add a single new row or multiple rows of data to the table.
- fnAddData(data:any, redraw?:boolean) : number[];
-
- /// This function will make DataTables recalculate the column sizes.
- fnAdjustColumnSizing(redraw? : boolean) : void;
-
- /// Quickly and simply clear a table
- fnClearTable(redraw? : boolean) : void;
-
- /// The exact opposite of 'opening' a row, this function will close any rows which are currently 'open'.
- fnClose(node: Node) : number;
-
- /// Remove a row for the table
- fnDeleteRow(index: number, callback?: () => void, redraw?: boolean) : any[];
- fnDeleteRow(tr: Node, callback?: () => void, redraw?: boolean) : any[];
-
- /// Restore the table to it's original state in the DOM by removing all of DataTables enhancements,
- /// alterations to the DOM structure of the table and event listeners.
- fnDestroy(remove?: boolean) : void;
-
- /// Redraw the table
- fnDraw(complete? : boolean) : void;
-
- /// Filter the input based on data
- fnFilter(input: string, column? : number, regex?: boolean, smart? : boolean, showGlobal?: boolean, caseInsensitive? : boolean) : void;
-
- /// Get the data for the whole table, an individual row or an individual cell based on the provided parameters.
- fnGetData(row?: Node, col? : number) : any;
- fnGetData(row?: number, col? : number) : any;
-
- /// Get an array of the TR nodes that are used in the table's body.
- fnGetNodes(row? : number) : any; // Node[] | Node
-
- /// Get the array indexes of a particular cell from it's DOM element and column index including hidden columns
- fnGetPosition(node: Node) : any; // number | number[]
-
- /// Check to see if a row is 'open' or not.
- fnIsOpen(tr: Node) : boolean;
-
- /// This function will place a new row directly after a row which is currently on display on the page,
- /// with the HTML contents that is passed into the function.
- fnOpen(node: Node, html: string, clazz: string) : Node;
- fnOpen(node: Node, html: Node, clazz: string) : Node;
- fnOpen(node: Node, html: JQuery, clazz: string) : Node;
-
- /// Change the pagination - provides the internal logic for pagination in a simple API function.
- fnPageChange(action: string, redraw?: boolean) : void;
- fnPageChange(page: number, redraw?: boolean) : void;
-
- /// Show a particular column
- fnSetColumnVis(column: number, show: boolean, redraw?: boolean) : void;
-
- /// Get the settings for a particular table for external manipulation
- fnSettings() : Settings;
-
- /// Sort the table by a particular column
- fnSort(col: number) : void;
- fnSort(col: any[][]) : void;
-
- /// Attach a sort listener to an element for a given column
- fnSortListener(node: Node, column: number, callback? : () => void): void;
-
- /// Update a table cell or row - this method will accept either a single value to update the cell with,
- /// an array of values with one element for each column or an object in the same format as the original data source.
- fnUpdate(data: any, row: Node, column?:number, redraw?: boolean, action? : boolean) : number;
- fnUpdate(data: any, dataIndex: number, column?:number, redraw?: boolean, action? : boolean) : number;
-
- /// Provide a common method for plug-ins to check the version of DataTables being used,
- /// in order to ensure compatibility.
- fnVersionCheck(version: string) : boolean;
- }
-
- export interface Static
- {
- /// Provide a common method for plug-ins to check the version of DataTables being used,
- /// in order to ensure compatibility.
- fnVersionCheck(version: string) : boolean;
-
- /// Check if a TABLE node is a DataTable table already or not.
- fnIsDataTable(table: Node) : boolean;
-
- /// Get all DataTable tables that have been initialised.
- fnTables(visible? : boolean) : Node[];
- }
-
- export interface RowParams
- {
- /// Select TR elements that meet the current filter criterion ("applied") or all TR elements (i.e. no filter).
- filter?: string;
-
- /// Order of the TR elements in the processed array.
- /// Can be either 'current', whereby the current sorting of the table is used, or
- /// 'original' whereby the original order the data was read into the table is used.
- order?: string;
-
- /// Limit the selection to the currently displayed page
- /// ("current") or not ("all"). If 'current' is given, then order is assumed to be
- /// 'current' and filter is 'applied', regardless of what they might be given as.
- page?: string;
- }
-
- export interface Options
- {
- aaData?: any[];
- aaSorting?: any[];
- aaSortingFixed?: any[];
- ajax?: any;
- aLengthMenu?: any[];
- aoColumns?: ColumnOptions[];
- aoColumnDefs?: ColumnDef[];
- aoSearchCols?: any[];
- asStripClasses?: string[];
- bAutoWidth?: boolean;
- bDeferRender?: boolean;
- bDestroy?: boolean;
- bFilter?: boolean;
- bInfo?: boolean;
- bJQueryUI?: boolean;
- bLengthChange?: boolean;
- bPaginate?: boolean;
- bProcessing?: boolean;
- bRetrieve?: boolean;
- bScrollAutoCss?: boolean;
- bScrollCollapse?: boolean;
- bScrollInfinite?: boolean;
- bServerSide?: boolean;
- bSort?: boolean;
- bSortCellsTop?: boolean;
- bSortClasses?: boolean;
- bStateSave?: boolean;
- fnCookieCallback?: CookieCallback;
- fnCreatedRow?: RowCreatedCallback;
- fnDrawCallback?: DrawCallback;
- fnFooterCallback?: FooterCallback;
- fnFormatNumber?: FormatNumber;
- fnHeaderCallback?: HeaderCallback;
- fnInfoCallback?: InfoCallback;
- fnInitComplete?: InitComplete;
- fnPreDrawCallback?: PreDrawCallback;
- fnRowCallback?: RowCallback;
-
- fnStateLoadCallback?: StateLoadCallback;
- fnStateLoadParams?: StateLoadParams;
- fnStateLoaded?: StateLoaded;
- fnStateSaveCallback?: StateSaveCallback;
- fnStateSaveParams?: StateSaveParams;
- iCookieDuration?: number;
- iDeferLoading?: any;
- iDisplayLength?: number;
- iDisplayStart?: number;
- iScrollLoadGap?: number;
- iTabIndex?: number;
- oLanguage?: LanguageOptions;
- oSearch?: any;
- sAjaxDataProp?: string;
- sAjaxSource?: string;
- sCookiePrefix?: string;
- sDom?: string;
- sPaginationType?: string;
- sScrollX?: string;
- sScrollXInner?: string;
- sScrollY?: string;
- sServerMethod? : string;
- }
-
- export interface LanguageOptions
- {
- oAria? : AriaOptions;
- oPaginate? : PaginateOptions;
- sEmptyTable?: string;
- sInfo?: string;
- sInfoEmpty?: string;
- sInfoFiltered?: string;
- sInfoPostFix?: string;
- sInfoThousands?: string;
- sLengthMenu?: string;
- sLoadingRecords?: string;
- sProcessing?: string;
- sSearch?: string;
- sUrl?: string;
- sZeroRecords?: string;
- }
-
- export interface AriaOptions
- {
- sSortAscending?: string;
- sSortDescending?: string;
- }
-
- export interface PaginateOptions
- {
- sFirst?: string;
- sLast?: string;
- sNext?: string;
- sPrevious?: string;
- }
-
- export interface ColumnOptions
- {
- aDataSort?: number[];
- asSorting?: string[];
- bSearchable? : boolean;
- bSortable? : boolean;
- bVisible? : boolean;
- _bAutoType? : boolean;
- fnCreatedCell?: CreatedCell;
- iDataSort?: number;
- mData?: any;
- mRender?: any;
- sCellType?: string;
- sClass?: string;
- sContentPadding?: string;
- sDefaultContent?: string;
- sName?: string;
- sSortDataType?: string;
- sSortingClass?: string;
- sTitle?: string;
- sType?: string;
- sWidth?: string;
- }
-
- export interface ColumnDef extends ColumnOptions
- {
- aTargets: any[];
- }
-
- export interface Settings
- {
- oFeatures : Features;
- oScroll: ScrollingSettings;
- oLanguage : { fnInfoCallback : InfoCallback; };
- oBrowser : { bScrollOversize : boolean; };
- aanFeatures: Node[][];
- aoData: Row[];
- aiDisplay: number[];
- aiDisplayMaster: number[];
- aoColumns: Column[];
- aoHeader: any[];
- aoFooter: any[];
- asDataSearch: string[];
- oPreviousSearch: any;
- aoPreSearchCols: any[];
- aaSorting: any[][];
- aaSortingFixed: any[][];
- asStripeClasses: string[];
- asDestroyStripes: string[];
- sDestroyWidth: number;
- aoRowCallback: RowCallback[];
- aoHeaderCallback: HeaderCallback[];
- aoFooterCallback: FooterCallback[];
- aoDrawCallback: DrawCallback[];
- aoRowCreatedCallback: RowCreatedCallback[];
- aoPreDrawCallback: PreDrawCallback[];
- aoInitComplete: InitComplete[];
- aoStateSaveParams: StateSaveParams[];
- aoStateLoadParams: StateLoadParams[];
- aoStateLoaded: StateLoaded[];
- sTableId: string;
- nTable: Node;
- nTHead: Node;
- nTFoot: Node;
- nTBody: Node;
- nTableWrapper: Node;
- bDeferLoading: boolean;
- bInitialized: boolean;
- aoOpenRows: any[];
- sDom: string;
- sPaginationType: string;
- iCookieDuration: number;
- sCookiePrefix: string;
- fnCookieCallback: CookieCallback;
- aoStateSave: StateSaveCallback[];
- aoStateLoad: StateLoadCallback[];
- oLoadedState: any;
- sAjaxSource: string;
- sAjaxDataProp: string;
- bAjaxDataGet: boolean;
- jqXHR: any;
- fnServerData: any;
- aoServerParams: any[];
- sServerMethod: string;
- fnFormatNumber: FormatNumber;
- aLengthMenu: any[];
- iDraw: number;
- bDrawing: boolean;
- iDrawError: number;
- _iDisplayLength: number;
- _iDisplayStart: number;
- _iDisplayEnd: number;
- _iRecordsTotal: number;
- _iRecordsDisplay: number;
- bJUI: boolean;
- oClasses: any;
- bFiltered: boolean;
- bSorted: boolean;
- bSortCellsTop: boolean;
- oInit: any;
- aoDestroyCallback: any[];
- fnRecordsTotal: () => number;
- fnRecordsDisplay: () => number;
- fnDisplayEnd: () => number;
- oInstance : any;
- sInstance: string;
- iTabIndex: number;
- nScrollHead: Node;
- nScrollFoot: Node;
- }
-
- export interface Features
- {
- bAutoWidth: boolean;
- bDeferRender: boolean;
- bFilter: boolean;
- bInfo: boolean;
- bLengthChange: boolean;
- bPaginate: boolean;
- bProcessing: boolean;
- bServerSide: boolean;
- bSort: boolean;
- bSortClasses: boolean;
- bStateSave: boolean;
- }
-
- export interface ScrollingSettings
- {
- bAutoCss : boolean;
- bCollapse: boolean;
- bInfinite: boolean;
- iBarWidth: number;
- iLoadGap: number;
- sX: string;
- sY: string;
- }
-
- export interface Row
- {
- nTr: Node;
- _aData: any;
- _aSortData: any[];
- _anHidden: Node[];
- _sRowStripe: string;
- }
-
- export interface Column
- {
- aDataSort: any;
- asSorting: string[];
- bSearchable : boolean;
- bSortable : boolean;
- bVisible : boolean;
- _bAutoType : boolean;
- fnCreatedCell: CreatedCell;
- fnGetData: (data: any, specific: string) => any;
- fnSetData: (data: any, value: any) => void;
- mData: any;
- mRender: any;
- nTh: Node;
- nIf: Node;
- sClass: string;
- sContentPadding: string;
- sDefaultContent: string;
- sName: string;
- sSortDataType: string;
- sSortingClass: string;
- sSortingClassJUI: string;
- sTitle: string;
- sType: string;
- sWidth: string;
- sWidthOrig: string;
- }
-
- export interface CookieCallback
- {
- (name: string, data: any, expires: string, path: string, cookie: string) : void;
- }
-
- export interface RowCreatedCallback
- {
- (row: Node, data: any[], dataIndex: number) : void;
- }
-
- export interface DrawCallback
- {
- (settings: Settings) : void;
- }
-
- export interface FooterCallback
- {
- (foot: Element, data: any[], start:number, end:number, display: number[]) : void;
- }
-
- export interface FormatNumber
- {
- (toFormat: number) : string;
- }
-
- export interface HeaderCallback
- {
- (head: Element, data: any[], start:number, end:number, display: number[]) : void;
- }
-
- export interface InfoCallback
- {
- (settings: Settings, start: number, end: number, max:number, total: number, pre: string) : string;
- }
-
- export interface InitComplete
- {
- (settings: Settings, json: any) : void;
- }
-
- export interface PreDrawCallback
- {
- (settings: Settings) : boolean;
- }
-
- export interface RowCallback
- {
- (row : Settings, data: any[], displayIndex: number, displayIndexFull: number) : void;
- }
-
- export interface StateLoadCallback
- {
- (settings: Settings) : any;
- }
-
- export interface StateLoadParams
- {
- (settings: Settings, data: any) : void;
- }
-
- export interface StateLoaded
- {
- (settings: Settings, data: any) : void;
- }
-
- export interface StateSaveCallback
- {
- (settings: any, data:any) : void;
- }
-
- export interface StateSaveParams
- {
- (settings: any, data:any) : void;
- }
-
- export interface CreatedCell
- {
- (nTd: Node, cellData: any, rowData: any, row: number, col: number) : void;
- }
+interface JQueryStatic {
+ //TODO: Wrong, as jquery.d.ts has no interface for fn
+ dataTable: DataTables.StaticFunctions;
}
+
+declare module DataTables {
+ export interface DataTable extends DataTableCore {
+ /**
+ * Get the data for the whole table.
+ */
+ data(): DataTable;
+
+ /**
+ * Order Methods / Object
+ */
+ order: OrderMethods;
+
+ //#region "Cell/Cells"
+
+ /**
+ * Select the cell found by a cell selector
+ *
+ * @param cellSelector Cell selector.
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
+ */
+ cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods;
+
+ /**
+ * Select the cell found by a cell selector
+ *
+ * @param rowSelector Row selector.
+ * @param cellSelector Cell selector.
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
+ */
+ cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods;
+
+ /**
+ * Select all cells
+ *
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
+ */
+ cells(modifier?: IObjectSelectorModifier): CellsMethods;
+
+ /**
+ * Select cells found by a cell selector
+ *
+ * @param cellSelector Cell selector.
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
+ */
+ cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods;
+
+ /**
+ * Select cells found by both row and column selectors
+ *
+ * @param rowSelector Row selector.
+ * @param cellSelector Cell selector.
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
+ */
+ cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods;
+ //#endregion "Cell/Cells"
+
+ //#region "Column/Columns"
+
+ /**
+ * Column Methods / Object
+ */
+ column: ColumnMethodsModel;
+
+ /**
+ * Columns Methods / Object
+ */
+ columns: ColumnsMethodsModel;
+
+ //#endregion "Column/Columns"
+
+ //#region "Row/Rows"
+
+ /**
+ * Row Methode / Object
+ */
+ row: RowMethodsModel
+
+ /**
+ * Rows Methods / Object
+ */
+ rows: RowsMethodsModel
+
+ //#endregion "Row/Rows"
+
+ //#region "Table/Tables"
+
+ /**
+ * Select a table based on a selector from the API's context
+ *
+ * @param tableSelector Table selector.
+ */
+ table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods;
+
+ /**
+ * Select all tables
+ */
+ tables(): TablesMethods;
+
+ /**
+ * Select tables based on the given selector
+ *
+ * @param tableSelector Table selector.
+ */
+ tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods;
+
+ //#endregion "Table/Tables"
+ }
+
+ export interface DataTables extends DataTableCore {
+ [index: number]: DataTable;
+ }
+
+ interface IObjectSelectorModifier {
+ /**
+ * The order modifier provides the ability to control which order the rows are processed in.
+ * Values: 'current', 'applied', 'index', 'original'
+ */
+ order?: string;
+
+ /**
+ * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table.
+ * Values: 'none', 'applied', 'removed'
+ */
+ search?: string;
+
+ /**
+ * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used.
+ * Values: 'all', 'current'
+ */
+ page?: string;
+ }
+
+ //#region "Namespaces"
+
+ //#region "core-methods"
+
+ interface DataTableCore extends UtilityMethods {
+ /**
+ * Get jquery object
+ */
+ $(selector: string | Node | Node[]| JQuery, modifier?: IObjectSelectorModifier): JQuery;
+
+ ///// Almost identical to $ in operation, but in this case returns the data for the matched rows.
+ //_(selector: string | Node | Node[] | JQuery, modifier?: IObjectSelectorModifier): JQuery;
+
+ /**
+ * Ajax Methods
+ */
+ ajax: AjaxMethodModel;
+
+ /**
+ * Clear the table of all data.
+ */
+ clear(): DataTable;
+
+ /**
+ * Destroy the DataTables in the current context.
+ *
+ * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false).
+ */
+ destroy(remove?: boolean): DataTable;
+
+ /**
+ * Destroy the DataTables in the current context.
+ *
+ * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action.
+ */
+ draw(reset?: boolean): DataTable;
+
+ /**
+ * Table events removal.
+ *
+ * @param event Event name to remove.
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
+ */
+ off(event: string, callback?: Function): DataTable;
+
+ /**
+ * Table events listener.
+ *
+ * @param event Event to listen for.
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
+ */
+ on(event: string, callback: Function): DataTable;
+
+ /**
+ * Listen for a table event once and then remove the listener.
+ *
+ * @param event Event to listen for.
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
+ */
+ one(event: string, callback: Function): DataTable;
+
+ /**
+ * Page Methods / Object
+ */
+ page: PageMethods;
+
+ /**
+ * Get current search
+ */
+ search(): string;
+
+ /**
+ * Search for data in the table.
+ *
+ * @param input Search string to apply to the table.
+ * @param regex Treat as a regular expression (true) or not (default, false).
+ * @param smart Perform smart search.
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
+ */
+ search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable;
+
+ /**
+ * Obtain the table's settings object
+ */
+ settings(): DataTable;
+
+ /**
+ * Page Methods / Object
+ */
+ state: StateMethods;
+ }
+
+ //#region "ajax-methods"
+
+ interface AjaxMethods extends DataTable {
+ /**
+ * Reload the table data from the Ajax data source.
+ *
+ * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
+ * @param resetPaging Reset (default action or true) or hold the current paging position (false).
+ */
+ load(callback?: Function, resetPaging?: boolean): DataTable;
+ }
+
+ interface AjaxMethodModel {
+ /**
+ * Get the latest JSON data obtained from the last Ajax request DataTables made
+ */
+ json(): Object;
+
+ /**
+ * Get the data submitted by DataTables to the server in the last Ajax request
+ */
+ params(): Object;
+
+ /**
+ * Reload the table data from the Ajax data source.
+ *
+ * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
+ * @param resetPaging Reset (default action or true) or hold the current paging position (false).
+ */
+ reload(callback?: Function, resetPaging?: boolean): DataTable;
+
+ /**
+ * Reload the table data from the Ajax data source
+ */
+ url(): string;
+
+ /**
+ * Reload the table data from the Ajax data source
+ *
+ * @param url URL to set to be the Ajax data source for the table.
+ */
+ url(url: string): AjaxMethods;
+ }
+
+ //#endregion "ajax-methods"
+
+ //#region "order-methods"
+
+ interface OrderMethods {
+ /**
+ * Get the ordering applied to the table.
+ */
+ (): (string | number)[][];
+
+ /**
+ * Set the ordering applied to the table.
+ *
+ * @param order Order Model
+ */
+ (order?: (string | number)[]): DataTable;
+ (order?: (string | number)[][]): DataTable;
+ (order: (string | number)[], ...args: any[]): DataTable;
+
+ /**
+ * Add an ordering listener to an element, for a given column.
+ *
+ * @param node Selector
+ * @param column Column index
+ * @param callback Callback function
+ */
+ listener(node: string | Node | JQuery, column: number, callback: Function): DataTable;
+ }
+ //#endregion "order-methods"
+
+ //#region "page-methods"
+
+ interface PageMethods {
+ /**
+ * Get the current page of the table.
+ */
+ (): number;
+
+ /**
+ * Set the current page of the table.
+ *
+ * @param page Index or 'first', 'next', 'previous', 'last'
+ */
+ (page: number | string): DataTable;
+
+ /**
+ * Get paging information about the table
+ */
+ info(): PageMethodeModelInfoReturn;
+
+ /**
+ * Get the table's page length.
+ */
+ len(): number;
+
+ /**
+ * Set the table's page length.
+ *
+ * @param length Page length to set. use -1 to show all records.
+ */
+ len(length: number): DataTable;
+ }
+
+ interface PageMethodeModelInfoReturn {
+ page: number;
+ pages: number;
+ start: number;
+ end: number;
+ length: number;
+ recordsTotal: number;
+ recordsDisplay: number;
+ }
+
+ //#endregion "page-methods"
+
+ //#region "state-methods"
+
+ interface StateMethods {
+ /**
+ * Get the last saved state of the table
+ */
+ (): StateReturnModel;
+
+ /**
+ * Clear the saved state of the table.
+ */
+ clear(): DataTable;
+
+ /**
+ * Get the table state that was loaded during initialisation.
+ */
+ loaded(): StateReturnModel;
+
+ /**
+ * Trigger a state save.
+ */
+ save(): DataTable;
+ }
+
+ interface StateReturnModel {
+ time: number;
+ start: number;
+ length: number;
+ order: (string | number)[][];
+ search: SearchSettings;
+ columns: Array