Updated jquery.dataTables.d.ts for 1.10.6.

Version release notes: https://cdn.datatables.net/1.10.6/

* Added rows().every()
* Added columns().every()
* Added cells().every()
* Added init()
* Expanded method signature when ajax.data is used as a function.
This commit is contained in:
Boland, Craig
2016-09-20 12:22:11 -05:00
committed by Boland, Craig
parent e3c57dbe79
commit 19425cf327
2 changed files with 147 additions and 107 deletions
+103 -93
View File
@@ -82,21 +82,21 @@ $(document).ready(function () {
width: "200px"
}
col =
{
data: "",
orderData: [10, 11, 20],
render: "",
}
{
data: "",
orderData: [10, 11, 20],
render: "",
}
col =
{
data: colDataObject,
render: colRenderObject,
}
{
data: colDataObject,
render: colRenderObject,
}
col =
{
data: colDataFunc,
render: colRenderFunc,
}
{
data: colDataFunc,
render: colRenderFunc,
}
//#endregion "Column"
@@ -124,16 +124,16 @@ $(document).ready(function () {
};
colDef =
{
targets: "2",
cellType: "th",
};
{
targets: "2",
cellType: "th",
};
colDef =
{
targets: ["2", 5],
cellType: "th",
};
{
targets: ["2", 5],
cellType: "th",
};
//#endregion "ColumnDef"
@@ -159,7 +159,7 @@ $(document).ready(function () {
var ajaxFunc: DataTables.FunctionAjax = function (data, callback, settings) { };
var ajaxDataFunc: DataTables.FunctionAjaxData = function (data) {
var ajaxDataFunc: DataTables.FunctionAjaxData = function (data, settings) {
return data;
};
@@ -229,41 +229,41 @@ $(document).ready(function () {
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
],
};
{
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: "",
},
};
{
ajax: {
data: {},
dataSrc: "",
},
};
config =
{
ajax: {
data: ajaxDataFunc,
dataSrc: function (data) { },
},
};
{
ajax: {
data: ajaxDataFunc,
dataSrc: function (data) { },
},
};
//#endregion "Settings"
@@ -309,6 +309,8 @@ $(document).ready(function () {
draw = dt.draw(true);
draw.$("");
var initSettings = dt.init();
var off = dt.off("event");
off = dt.off("event", function () { });
off.$("");
@@ -385,11 +387,11 @@ $(document).ready(function () {
var select = $('<select />')
.appendTo('body')
.on('change', function () {
dt
.column(0)
.search($(this).val())
.draw();
});
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)
@@ -397,8 +399,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
select.append($('<option value="' + d + '">' + d + '</option>'));
});
select.append($('<option value="' + d + '">' + d + '</option>'));
});
var cells_data = cells.data();
var data = dt
@@ -438,6 +440,9 @@ $(document).ready(function () {
console.log(data);
});
cells.every(function () { });
cells.every(function (cellRowIdx, cellColIdx, tableLoop, cellLoop) { });
var cell = dt.cell(":contains('Not shipped')");
cell = dt.cell(function () { });
cell = dt.cell($(""));
@@ -519,12 +524,12 @@ $(document).ready(function () {
dt.column(colIdx).footer()
)
.on('change', function () {
dt
.column(colIdx)
.search($(this).val())
.draw();
});
dt
.column(colIdx)
.search($(this).val())
.draw();
});
// Get the search data for the first column and add to the select list
dt
.column(colIdx)
@@ -532,8 +537,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
select.append($('<option value="' + d + '">' + d + '</option>'));
});
select.append($('<option value="' + d + '">' + d + '</option>'));
});
});
var columns_data = columns.data();
@@ -545,7 +550,7 @@ $(document).ready(function () {
.sort() // Sort data alphabetically
.unique() // Reduce to unique values
.join('<br>')
);
);
//var idx = dt
// .columns('.check')
@@ -603,12 +608,12 @@ $(document).ready(function () {
dt.column(0).footer()
)
.on('change', function () {
dt
.column(0)
.search($(this).val())
.draw();
});
dt
.column(0)
.search($(this).val())
.draw();
});
// Get the search data for the first column and add to the select list
dt
.column(0)
@@ -616,18 +621,18 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
select.append($('<option value="' + d + '">' + d + '</option>'));
});
select.append($('<option value="' + d + '">' + d + '</option>'));
});
var column_data = column.data();
alert('Column 4 sum: ' +
dt
.column(4)
.data()
.reduce(function (a, b) {
return a + b;
})
);
.reduce(function (a, b) {
return a + b;
})
);
var column_dataSrc = column.dataSrc();
$('#example').on('click', 'tbody td', function () {
@@ -688,11 +693,11 @@ $(document).ready(function () {
)
.on('change', function () {
dt
.column(colIdx)
.search($(this).val())
.draw();
});
.column(colIdx)
.search($(this).val())
.draw();
});
// Get the search data for the first column and add to the select list
dt
.column(colIdx)
@@ -700,8 +705,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
select.append($('<option value="' + d + '">' + d + '</option>'));
});
select.append($('<option value="' + d + '">' + d + '</option>'));
});
});
var column_visible_get = column.visible();
@@ -709,12 +714,15 @@ $(document).ready(function () {
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
dt.columns().every(function () { });
dt.columns().every(function (colIdx, tableLoop, colLoop) { });
//#endregion "Methods-Column"
//#region "Methods-Row"
@@ -754,6 +762,8 @@ $(document).ready(function () {
var rows_11 = dt.rows("selector").remove();
var rows_12 = dt.rows("selector").nodes();
var rows_13 = dt.rows.add([{}, {}]);
dt.rows().every(function () { });
dt.rows().every(function (rowIdx, tableLoop, rowLoop) { });
var table3 = $('#example').DataTable();
table3.row.add({
@@ -791,9 +801,9 @@ $(document).ready(function () {
pupil,
])
.draw();
//.nodes()
//.to$()
//.addClass('new');
//.nodes()
//.to$()
//.addClass('new');
$('#example tbody').on('click', 'td.details-control', function () {
var tr = $(this).parents('tr');
@@ -829,7 +839,7 @@ $(document).ready(function () {
'<td>' + rowIdx + '.3</td>' +
'<td>' + rowIdx + '.4</td>' +
'</tr>'
)
)
)
.show();
});
+44 -14
View File
@@ -1,4 +1,4 @@
// Type definitions for JQuery DataTables 1.10.5
// Type definitions for JQuery DataTables 1.10.6
// Project: http://www.datatables.net
// Definitions by: Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Omid Rad <https://github.com/omidkrad>, Armin Sander <https://github.com/pragmatrix/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -159,7 +159,7 @@ declare namespace DataTables {
/**
* Get jquery object
*/
$(selector: string | Node | Node[]| JQuery, modifier?: ObjectSelectorModifier): JQuery;
$(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
///// Almost identical to $ in operation, but in this case returns the data for the matched rows.
//_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
@@ -188,6 +188,11 @@ declare namespace DataTables {
*/
draw(reset?: boolean): DataTable;
/*
* Get the initialisation options used for the table. Since: DataTables 1.10.6
*/
init(): Settings;
/**
* Table events removal.
*
@@ -628,6 +633,13 @@ declare namespace DataTables {
*/
data(): DataTable;
/**
* Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6
*
* @param fn Function to execute for every cell selected.
*/
every(fn: (cellRowIdx?: number, cellColIdx?: number, tableLoop?: number, cellLoop?: number) => void): DataTable;
/**
* Get index information about the selected cells
*/
@@ -749,6 +761,13 @@ declare namespace DataTables {
*/
dataSrc(): DataTable;
/**
* Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
*
* @param fn Function to execute for every column selected.
*/
every(fn: (colIdx?: number, tableLoop?: number, colLoop?: number) => void): DataTable;
/**
* Get the column indexes of the selected columns.
*
@@ -847,7 +866,7 @@ declare namespace DataTables {
*
* @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table
*/
add(data: any[]| Object): DataTable;
add(data: any[] | Object): DataTable;
}
interface RowMethods extends DataTableCore, CommonRowMethod {
@@ -859,14 +878,14 @@ declare namespace DataTables {
/**
* Get the data for the selected row
*/
data(): any[]| Object;
data(): any[] | Object;
/**
* Set the data for the selected row
*
* @param d Data to use for the row.
*/
data(d: any[]| Object): DataTable;
data(d: any[] | Object): DataTable;
/**
* Get the row index of the row column.
@@ -919,7 +938,14 @@ declare namespace DataTables {
*
* @param d Data to use for the row.
*/
data(d: any[]| Object): DataTable;
data(d: any[] | Object): DataTable;
/**
* Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
*
* @param fn Function to execute for every row selected.
*/
every(fn: (rowIdx?: number, tableLoop?: number, rowLoop?: number) => void): DataTable;
/**
* Get the row indexes of the selected rows.
@@ -1031,7 +1057,7 @@ declare namespace DataTables {
*
* @param table Selector string for table
*/
Api(selector: string | Node | Node[]| JQuery): DataTables.DataTable;
Api(selector: string | Node | Node[] | JQuery): DataTables.DataTable;
}
export interface StaticUtilFunctions {
@@ -1175,7 +1201,7 @@ declare namespace DataTables {
/**
* Change the options in the page length select list. Since: 1.10
*/
lengthMenu?: (number | string)[]| (number | string)[][];
lengthMenu?: (number | string)[] | (number | string)[][];
/**
* Control which cell the order event handler will be applied to in a column. Since: 1.10
@@ -1190,12 +1216,12 @@ declare namespace DataTables {
/**
* Initial order (sort) to apply to the table. Since: 1.10
*/
order?: (string | number)[]| (string | number)[][];
order?: (string | number)[] | (string | number)[][];
/**
* Ordering to always be applied to the table. Since: 1.10
*/
orderFixed?: (string | number)[]| (string | number)[][]| Object;
orderFixed?: (string | number)[] | (string | number)[][] | Object;
/**
* Multiple column ordering ability control. Since: 1.10
@@ -1395,7 +1421,11 @@ declare namespace DataTables {
}
interface FunctionAjaxData {
(data: Object): string | Object;
/*
* @param data Data that DataTables has constructed for the request.
* @param settings DataTables settings object. Since 1.10.6
*/
(data: Object, settings: Settings): string | Object;
}
//#endregion "ajax-settings"
@@ -1558,7 +1588,7 @@ declare namespace DataTables {
//#region "callback-functions"
interface FunctionCreateRow {
(row: Node, data: any[]| Object, dataIndex: number): void;
(row: Node, data: any[] | Object, dataIndex: number): void;
}
interface FunctionDrawCallback {
@@ -1590,7 +1620,7 @@ declare namespace DataTables {
}
interface FunctionRowCallback {
(row: Node, data: any[]| Object): void;
(row: Node, data: any[] | Object): void;
}
interface FunctionStateLoadCallback {
@@ -1617,7 +1647,7 @@ declare namespace DataTables {
//#region "language-settings"
// these are all optional
// these are all optional
interface LanguageSettings {
emptyTable?: string;
info?: string;