From 6c9c2abac0a621a41fe0cd60e1c1fdbd1e0d06b7 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 22 Feb 2024 17:05:24 +0000 Subject: [PATCH] Features: Updates to operate with DataTables 2 --- .../dataTables.alphabetSearch.d.ts | 14 +- .../dataTables.alphabetSearch.js | 15 +- .../dataTables.alphabetSearch.min.js | 2 +- .../dataTables.alphabetSearch.min.mjs | 2 +- .../dataTables.alphabetSearch.mjs | 15 +- features/alphabetSearch/index.html | 21 +- .../src/dataTables.alphabetSearch.ts | 32 +- .../dataTables.conditionalPageLength.js | 2 +- .../dataTables.conditionalPageLength.min.js | 2 +- .../dataTables.conditionalPageLength.min.mjs | 2 +- .../dataTables.conditionalPageLength.mjs | 2 +- .../src/dataTables.conditionalPageLength.ts | 2 +- .../dataTables.conditionalPaging.js | 2 +- .../dataTables.conditionalPaging.min.js | 2 +- .../dataTables.conditionalPaging.min.mjs | 2 +- .../dataTables.conditionalPaging.mjs | 2 +- .../src/dataTables.conditionalPaging.ts | 2 +- features/deepLink/dataTables.deepLink.min.js | 2 +- .../dataTables.excludeSearch.d.ts | 19 - .../excludeSearch/dataTables.excludeSearch.js | 111 ---- .../dataTables.excludeSearch.min.js | 2 - .../dataTables.excludeSearch.min.mjs | 2 - .../dataTables.excludeSearch.mjs | 70 --- .../src/dataTables.excludeSearch.ts | 94 ---- .../fuzzySearch/dataTables.fuzzySearch.js | 36 +- .../fuzzySearch/dataTables.fuzzySearch.min.js | 2 +- .../dataTables.fuzzySearch.min.mjs | 2 +- .../fuzzySearch/dataTables.fuzzySearch.mjs | 36 +- features/fuzzySearch/index.html | 6 +- features/fuzzySearch/rankColumn.html | 6 +- features/fuzzySearch/returnSearch.html | 6 +- .../fuzzySearch/src/dataTables.fuzzySearch.ts | 40 +- features/fuzzySearch/stateSaving.html | 6 +- features/fuzzySearch/threshold.html | 6 +- features/fuzzySearch/toggleSmart.html | 6 +- .../lengthLinks/dataTables.lengthLinks.css | 4 +- .../lengthLinks/dataTables.lengthLinks.d.ts | 3 + .../lengthLinks/dataTables.lengthLinks.js | 23 +- .../lengthLinks/dataTables.lengthLinks.min.js | 2 +- .../dataTables.lengthLinks.min.mjs | 2 +- .../lengthLinks/dataTables.lengthLinks.mjs | 23 +- features/lengthLinks/index.html | 530 ++++++++++++++++++ .../lengthLinks/src/dataTables.lengthLinks.ts | 28 +- features/mark.js/datatables.mark.min.js | 2 +- .../pageResize/dataTables.pageResize.min.js | 2 +- features/pageResize/index.html | 6 +- features/pageResize/scrolling.html | 6 +- features/pageResize/serverSide.html | 6 +- features/rowFill/dataTables.rowFill.min.js | 2 +- features/rowFill/index.html | 6 +- .../dataTables.scrollResize.min.js | 2 +- .../dataTables.scrollResize.min.mjs | 2 +- .../scrollToTop/dataTables.scrollToTop.min.js | 2 +- .../searchFade/dataTables.searchFade.d.ts | 3 + features/searchFade/dataTables.searchFade.js | 15 +- .../searchFade/dataTables.searchFade.min.js | 2 +- .../searchFade/dataTables.searchFade.min.mjs | 2 +- features/searchFade/dataTables.searchFade.mjs | 15 +- features/searchFade/index.html | 529 +++++++++++++++++ .../searchFade/src/dataTables.searchFade.ts | 23 +- .../dataTables.searchHighlight.min.js | 2 +- features/searchHighlight/index.html | 524 +++++++++++++++++ .../dataTables.slidingChild.min.js | 2 +- make.sh | 10 +- 64 files changed, 1880 insertions(+), 471 deletions(-) delete mode 100644 features/excludeSearch/dataTables.excludeSearch.d.ts delete mode 100644 features/excludeSearch/dataTables.excludeSearch.js delete mode 100644 features/excludeSearch/dataTables.excludeSearch.min.js delete mode 100644 features/excludeSearch/dataTables.excludeSearch.min.mjs delete mode 100644 features/excludeSearch/dataTables.excludeSearch.mjs delete mode 100644 features/excludeSearch/src/dataTables.excludeSearch.ts create mode 100644 features/lengthLinks/index.html create mode 100644 features/searchFade/index.html create mode 100644 features/searchHighlight/index.html diff --git a/features/alphabetSearch/dataTables.alphabetSearch.d.ts b/features/alphabetSearch/dataTables.alphabetSearch.d.ts index dac6eaab..b78f82a0 100644 --- a/features/alphabetSearch/dataTables.alphabetSearch.d.ts +++ b/features/alphabetSearch/dataTables.alphabetSearch.d.ts @@ -1,15 +1,16 @@ /*! © SpryMedia Ltd - datatables.net/license */ +interface AlphabetSearchOptions { + column?: number; + caseSensitive?: boolean; + numbers?: boolean; +} declare module 'datatables.net' { interface DataTablesStatic { /** Show an set of alphabet buttons alongside a table providing search input options */ AlphabetSearch(settings: any): void; } interface Config { - alphabet?: { - column: number; - caseSensitive: boolean; - numbers: boolean; - }; + alphabet?: AlphabetSearchOptions; } interface Api { alphabetSearch: ApiAlphabet; @@ -21,5 +22,8 @@ declare module 'datatables.net' { node(): JQuery | null; recalc(): Api; } + interface Feature { + alphabetSearch?: AlphabetSearchOptions; + } } export {}; diff --git a/features/alphabetSearch/dataTables.alphabetSearch.js b/features/alphabetSearch/dataTables.alphabetSearch.js index 4bf0853a..3ce4cb82 100644 --- a/features/alphabetSearch/dataTables.alphabetSearch.js +++ b/features/alphabetSearch/dataTables.alphabetSearch.js @@ -58,9 +58,16 @@ var DataTable = $.fn.dataTable; * * License MIT - http://datatables.net/license/mit * - * For more detailed information please see: - * http://datatables.net/blog/2014-09-22 + * Please see [this blog post](http://datatables.net/blog/2014-09-22). + * + * @example + * $('#myTable').DataTable( { + * layout: { + * topStart: 'alphabetSearch; + * } + * } ); */ +; // Search function DataTable.Api.register('alphabetSearch()', function (searchTerm) { this.iterator('table', function (context) { @@ -217,6 +224,10 @@ DataTable.ext.feature.push({ }, cFeature: 'A', }); +DataTable.feature.register('alphabetSearch', function (settings, opts) { + var search = new DataTable.AlphabetSearch(settings); + return search.node(); +}); return DataTable; diff --git a/features/alphabetSearch/dataTables.alphabetSearch.min.js b/features/alphabetSearch/dataTables.alphabetSearch.min.js index 039f95c1..123a7771 100644 --- a/features/alphabetSearch/dataTables.alphabetSearch.min.js +++ b/features/alphabetSearch/dataTables.alphabetSearch.min.js @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -!function(a){var n,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return a(t,window,document)}):"object"==typeof exports?(n=require("jquery"),i=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||n(t),i(t,e),a(e,0,t.document)}:(i(window,n),module.exports=a(n,window,window.document))):a(jQuery,window,document)}(function(o,t,e,i){"use strict";var r=o.fn.dataTable;function c(t,e,a){e.empty(),e.append("Search: ");var t=t.column(a.column).data(),n=function(t,e){for(var a,n={},i=0,r=t.length;i/g,"").charAt(0):t[i].toString().replace(/<.*?>/g,"").charAt(0).toUpperCase()]?n[a]++:n[a]=1;return n}(t,a);if(o('').data("letter","").data("match-count",t.length).html("None").appendTo(e),a.numbers)for(var i=0;i<10;i++){var r=String.fromCharCode(48+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}for(i=0;i<26;i++){r=String.fromCharCode(65+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}if(a.caseSensitive)for(i=0;i<26;i++){r=String.fromCharCode(97+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}o('
').appendTo(e)}return r.Api.register("alphabetSearch()",function(e){return this.iterator("table",function(t){t.alphabetSearch=e}),this}),r.Api.register("alphabetSearch.recalc()",function(){return this.iterator("table",function(t){c(new r.Api(t),t._alphabet,t._alphabetOptions)}),this}),r.Api.register("alphabetSearch.node()",function(){return this._context.length?this._context._alphabet:null}),r.ext.search.push(function(t,e){if(!t.alphabetSearch)return!0;var a=0,n=!1;if(t.oInit.alphabet!==i&&(a=t.oInit.alphabet.column!==i?t.oInit.alphabet.column:0,n=t.oInit.alphabet.caseSensitive!==i&&t.oInit.alphabet.caseSensitive),n){if(e[a].charAt(0)===t.alphabetSearch)return!0}else if(e[a].charAt(0).toUpperCase()===t.alphabetSearch)return!0;return!1}),r.AlphabetSearch=function(t){var e=new r.Api(t),a=o('
'),n=o.extend({column:0,caseSensitive:!1,numbers:!1},e.init().alphabet);c(e,a,n),t._alphabet=a,t._alphabetOptions=n,a.on("click","span",function(){a.find(".active").removeClass("active"),o(this).addClass("active"),e.alphabetSearch(o(this).data("letter")).draw()}),a.on("mouseenter","span",function(){a.find("div.alphabetInfo").css({opacity:1,left:o(this).position().left,width:o(this).width()}).html(o(this).data("match-count"))}).on("mouseleave","span",function(){a.find("div.alphabetInfo").css("opacity",0)}),this.node=function(){return a}},r.ext.feature.push({fnInit:function(t){return new r.AlphabetSearch(t).node()},cFeature:"A"}),r}); \ No newline at end of file +!function(a){var n,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return a(t,window,document)}):"object"==typeof exports?(n=require("jquery"),i=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||n(t),i(t,e),a(e,0,t.document)}:(i(window,n),module.exports=a(n,window,window.document))):a(jQuery,window,document)}(function(o,t,e){"use strict";var i=o.fn.dataTable;function r(t,e,a){e.empty(),e.append("Search: ");var t=t.column(a.column).data(),n=function(t,e){for(var a,n={},i=0,r=t.length;i/g,"").charAt(0):t[i].toString().replace(/<.*?>/g,"").charAt(0).toUpperCase()]?n[a]++:n[a]=1;return n}(t,a);if(o('').data("letter","").data("match-count",t.length).html("None").appendTo(e),a.numbers)for(var i=0;i<10;i++){var r=String.fromCharCode(48+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}for(i=0;i<26;i++){r=String.fromCharCode(65+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}if(a.caseSensitive)for(i=0;i<26;i++){r=String.fromCharCode(97+i);o("").data("letter",r).data("match-count",n[r]||0).addClass(n[r]?"":"empty").html(r).appendTo(e)}o('
').appendTo(e)}return i.Api.register("alphabetSearch()",function(e){return this.iterator("table",function(t){t.alphabetSearch=e}),this}),i.Api.register("alphabetSearch.recalc()",function(){return this.iterator("table",function(t){r(new i.Api(t),t._alphabet,t._alphabetOptions)}),this}),i.Api.register("alphabetSearch.node()",function(){return this._context.length?this._context._alphabet:null}),i.ext.search.push(function(t,e){if(!t.alphabetSearch)return!0;var a=0,n=!1;if(void 0!==t.oInit.alphabet&&(a=void 0!==t.oInit.alphabet.column?t.oInit.alphabet.column:0,n=void 0!==t.oInit.alphabet.caseSensitive&&t.oInit.alphabet.caseSensitive),n){if(e[a].charAt(0)===t.alphabetSearch)return!0}else if(e[a].charAt(0).toUpperCase()===t.alphabetSearch)return!0;return!1}),i.AlphabetSearch=function(t){var e=new i.Api(t),a=o('
'),n=o.extend({column:0,caseSensitive:!1,numbers:!1},e.init().alphabet);r(e,a,n),t._alphabet=a,t._alphabetOptions=n,a.on("click","span",function(){a.find(".active").removeClass("active"),o(this).addClass("active"),e.alphabetSearch(o(this).data("letter")).draw()}),a.on("mouseenter","span",function(){a.find("div.alphabetInfo").css({opacity:1,left:o(this).position().left,width:o(this).width()}).html(o(this).data("match-count"))}).on("mouseleave","span",function(){a.find("div.alphabetInfo").css("opacity",0)}),this.node=function(){return a}},i.ext.feature.push({fnInit:function(t){return new i.AlphabetSearch(t).node()},cFeature:"A"}),i.feature.register("alphabetSearch",function(t,e){return new i.AlphabetSearch(t).node()}),i}); \ No newline at end of file diff --git a/features/alphabetSearch/dataTables.alphabetSearch.min.mjs b/features/alphabetSearch/dataTables.alphabetSearch.min.mjs index 46743b67..b1bde50f 100644 --- a/features/alphabetSearch/dataTables.alphabetSearch.min.mjs +++ b/features/alphabetSearch/dataTables.alphabetSearch.min.mjs @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function bin(a,t){for(var e,n={},r=0,i=a.length;r/g,"").charAt(0):a[r].toString().replace(/<.*?>/g,"").charAt(0).toUpperCase()]?n[e]++:n[e]=1;return n}function draw(a,t,e){t.empty(),t.append("Search: ");var a=a.column(e.column).data(),n=bin(a,e);if($('').data("letter","").data("match-count",a.length).html("None").appendTo(t),e.numbers)for(var r=0;r<10;r++){var i=String.fromCharCode(48+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}for(r=0;r<26;r++){i=String.fromCharCode(65+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}if(e.caseSensitive)for(r=0;r<26;r++){i=String.fromCharCode(97+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}$('
').appendTo(t)}DataTable.Api.register("alphabetSearch()",function(t){return this.iterator("table",function(a){a.alphabetSearch=t}),this}),DataTable.Api.register("alphabetSearch.recalc()",function(){return this.iterator("table",function(a){draw(new DataTable.Api(a),a._alphabet,a._alphabetOptions)}),this}),DataTable.Api.register("alphabetSearch.node()",function(){return this._context.length?this._context._alphabet:null}),DataTable.ext.search.push(function(a,t){if(!a.alphabetSearch)return!0;var e=0,n=!1;if(void 0!==a.oInit.alphabet&&(e=void 0!==a.oInit.alphabet.column?a.oInit.alphabet.column:0,n=void 0!==a.oInit.alphabet.caseSensitive&&a.oInit.alphabet.caseSensitive),n){if(t[e].charAt(0)===a.alphabetSearch)return!0}else if(t[e].charAt(0).toUpperCase()===a.alphabetSearch)return!0;return!1}),DataTable.AlphabetSearch=function(a){var t=new DataTable.Api(a),e=$('
'),n=$.extend({column:0,caseSensitive:!1,numbers:!1},t.init().alphabet);draw(t,e,n),a._alphabet=e,a._alphabetOptions=n,e.on("click","span",function(){e.find(".active").removeClass("active"),$(this).addClass("active"),t.alphabetSearch($(this).data("letter")).draw()}),e.on("mouseenter","span",function(){e.find("div.alphabetInfo").css({opacity:1,left:$(this).position().left,width:$(this).width()}).html($(this).data("match-count"))}).on("mouseleave","span",function(){e.find("div.alphabetInfo").css("opacity",0)}),this.node=function(){return e}},DataTable.ext.feature.push({fnInit:function(a){return new DataTable.AlphabetSearch(a).node()},cFeature:"A"});export default DataTable; \ No newline at end of file +import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function bin(a,t){for(var e,n={},r=0,i=a.length;r/g,"").charAt(0):a[r].toString().replace(/<.*?>/g,"").charAt(0).toUpperCase()]?n[e]++:n[e]=1;return n}function draw(a,t,e){t.empty(),t.append("Search: ");var a=a.column(e.column).data(),n=bin(a,e);if($('').data("letter","").data("match-count",a.length).html("None").appendTo(t),e.numbers)for(var r=0;r<10;r++){var i=String.fromCharCode(48+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}for(r=0;r<26;r++){i=String.fromCharCode(65+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}if(e.caseSensitive)for(r=0;r<26;r++){i=String.fromCharCode(97+r);$("").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(t)}$('
').appendTo(t)}DataTable.Api.register("alphabetSearch()",function(t){return this.iterator("table",function(a){a.alphabetSearch=t}),this}),DataTable.Api.register("alphabetSearch.recalc()",function(){return this.iterator("table",function(a){draw(new DataTable.Api(a),a._alphabet,a._alphabetOptions)}),this}),DataTable.Api.register("alphabetSearch.node()",function(){return this._context.length?this._context._alphabet:null}),DataTable.ext.search.push(function(a,t){if(!a.alphabetSearch)return!0;var e=0,n=!1;if(void 0!==a.oInit.alphabet&&(e=void 0!==a.oInit.alphabet.column?a.oInit.alphabet.column:0,n=void 0!==a.oInit.alphabet.caseSensitive&&a.oInit.alphabet.caseSensitive),n){if(t[e].charAt(0)===a.alphabetSearch)return!0}else if(t[e].charAt(0).toUpperCase()===a.alphabetSearch)return!0;return!1}),DataTable.AlphabetSearch=function(a){var t=new DataTable.Api(a),e=$('
'),n=$.extend({column:0,caseSensitive:!1,numbers:!1},t.init().alphabet);draw(t,e,n),a._alphabet=e,a._alphabetOptions=n,e.on("click","span",function(){e.find(".active").removeClass("active"),$(this).addClass("active"),t.alphabetSearch($(this).data("letter")).draw()}),e.on("mouseenter","span",function(){e.find("div.alphabetInfo").css({opacity:1,left:$(this).position().left,width:$(this).width()}).html($(this).data("match-count"))}).on("mouseleave","span",function(){e.find("div.alphabetInfo").css("opacity",0)}),this.node=function(){return e}},DataTable.ext.feature.push({fnInit:function(a){return new DataTable.AlphabetSearch(a).node()},cFeature:"A"}),DataTable.feature.register("alphabetSearch",function(a,t){return new DataTable.AlphabetSearch(a).node()});export default DataTable; \ No newline at end of file diff --git a/features/alphabetSearch/dataTables.alphabetSearch.mjs b/features/alphabetSearch/dataTables.alphabetSearch.mjs index 5ebfc30c..c0a0f441 100644 --- a/features/alphabetSearch/dataTables.alphabetSearch.mjs +++ b/features/alphabetSearch/dataTables.alphabetSearch.mjs @@ -18,9 +18,16 @@ let $ = jQuery; * * License MIT - http://datatables.net/license/mit * - * For more detailed information please see: - * http://datatables.net/blog/2014-09-22 + * Please see [this blog post](http://datatables.net/blog/2014-09-22). + * + * @example + * $('#myTable').DataTable( { + * layout: { + * topStart: 'alphabetSearch; + * } + * } ); */ +; // Search function DataTable.Api.register('alphabetSearch()', function (searchTerm) { this.iterator('table', function (context) { @@ -177,6 +184,10 @@ DataTable.ext.feature.push({ }, cFeature: 'A', }); +DataTable.feature.register('alphabetSearch', function (settings, opts) { + var search = new DataTable.AlphabetSearch(settings); + return search.node(); +}); export default DataTable; diff --git a/features/alphabetSearch/index.html b/features/alphabetSearch/index.html index 1e466065..0d15ea8a 100644 --- a/features/alphabetSearch/index.html +++ b/features/alphabetSearch/index.html @@ -6,18 +6,20 @@ DataTables example - Fuzzy Searching - + - - + + - + + - + + - + + - + + - + + - + + + + + + + +
+
+

DataTables example Length links

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSydney232010/09/20$85,600
Angelica RamosChief Executive Officer (CEO)London472009/10/09$1,200,000
Gavin JoyceDeveloperEdinburgh422010/12/22$92,575
Jennifer ChangRegional DirectorSingapore282010/11/14$357,650
Brenden WagnerSoftware EngineerSan Francisco282011/06/07$206,850
Fiona GreenChief Operating Officer (COO)San Francisco482010/03/11$850,000
Shou ItouRegional MarketingTokyo202011/08/14$163,000
Michelle HouseIntegration SpecialistSydney372011/06/02$95,400
Suki BurksDeveloperLondon532009/10/22$114,500
Prescott BartlettTechnical AuthorLondon272011/05/07$145,000
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
Howard HatfieldOffice ManagerSan Francisco512008/12/16$164,500
Hope FuentesSecretarySan Francisco412010/02/12$109,850
Vivian HarrellFinancial ControllerSan Francisco622009/02/14$452,500
Timothy MooneyOffice ManagerLondon372008/12/11$136,200
Jackson BradshawDirectorNew York652008/09/26$645,750
Olivia LiangSupport EngineerSingapore642011/02/03$234,500
Bruno NashSoftware EngineerLondon382011/05/03$163,500
Sakura YamamotoSupport EngineerTokyo372009/08/19$139,575
Thor WaltonDeveloperNew York612013/08/11$98,540
Finn CamachoSupport EngineerSan Francisco472009/07/07$87,500
Serge BaldwinData CoordinatorSingapore642012/04/09$138,575
Zenaida FrankSoftware EngineerNew York632010/01/04$125,250
Zorita SerranoSoftware EngineerSan Francisco562012/06/01$115,000
Jennifer AcostaJunior Javascript DeveloperEdinburgh432013/02/01$75,650
Cara StevensSales AssistantNew York462011/12/06$145,600
Hermione ButlerRegional DirectorLondon472011/03/21$356,250
Lael GreerSystems AdministratorLondon212009/02/27$103,500
Jonas AlexanderDeveloperSan Francisco302010/07/14$86,500
Shad DeckerRegional DirectorEdinburgh512008/11/13$183,000
Michael BruceJavascript DeveloperSingapore292011/06/27$183,000
Donna SniderCustomer SupportNew York272011/01/25$112,000
NamePositionOfficeAgeStart dateSalary
+
+

The Javascript shown below is used to initialise the table shown in this example:

+ +$(document).ready(function() { + var table = $('#example').DataTable({ + layout: { + top: 'lengthLinks' + } + }); +} ); + +
+ + + diff --git a/features/lengthLinks/src/dataTables.lengthLinks.ts b/features/lengthLinks/src/dataTables.lengthLinks.ts index 7affda64..5b8aeb34 100644 --- a/features/lengthLinks/src/dataTables.lengthLinks.ts +++ b/features/lengthLinks/src/dataTables.lengthLinks.ts @@ -7,19 +7,22 @@ * @author Allan Jardine * * This feature plug-in for DataTables adds page length control links to the - * DataTable. The `dom` option can be used to insert the control using the `L` - * character option and it uses the `lengthMenu` options of DataTables to - * determine what to display. + * DataTable. The `-init layout` option can be used to insert the control + * using the `lengthLinks` option. * * @example * $('#myTable').DataTable( { - * dom: 'Lfrtip' + * layout: { + * topStart: 'lengthLinks; + * } * } ); * * @example * $('#myTable').DataTable( { + * layout: { + * topStart: 'lengthLinks; + * }, * lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ] - * dom: 'Lfrtip' * } ); */ @@ -30,12 +33,16 @@ declare module 'datatables.net' { /** Page length control via links for DataTables */ LengthLinks(settings: any): void; } + + interface Feature { + lengthLinks?: {} + } } DataTable.LengthLinks = function (inst) { var api = new DataTable.Api(inst); var settings = api.settings()[0]; - var container = $('
').addClass(settings.oClasses.sLength); + var container = $('
').addClass('dt-lengthLinks'); var lastLength: number | null = null; // API so the feature wrapper can return the node to insert @@ -67,7 +74,9 @@ DataTable.LengthLinks = function (inst) { }); container.html( - settings.oLanguage.sLengthMenu.replace('_MENU_', out.join(' | ')) + settings.oLanguage.sLengthMenu + .replace('_MENU_', out.join(' | ')) + .replace('_ENTRIES_', api.i18n('entries', '', 10)) ); lastLength = api.page.len(); }); @@ -86,3 +95,8 @@ DataTable.ext.feature.push({ cFeature: 'L', sFeature: 'LengthLinks', }); + +DataTable.feature.register('lengthLinks', function (settings) { + var l = new DataTable.LengthLinks(settings); + return l.container(); +}); diff --git a/features/mark.js/datatables.mark.min.js b/features/mark.js/datatables.mark.min.js index 2720a4be..959c24f9 100644 --- a/features/mark.js/datatables.mark.min.js +++ b/features/mark.js/datatables.mark.min.js @@ -4,4 +4,4 @@ * Copyright (c) 2016–2020, Julian Kühnel, SpryMedia Ltd * Released under the MIT license https://git.io/voRZ7 *****************************************************/ -!function(n){var i,s;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(i=require("jquery"),s=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),s(t,e),n(e,0,t.document)}:(s(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(a,t,e,n){"use strict";var i=a.fn.dataTable;class s{instance;options;intervalThreshold;intervalMs;constructor(t,e){if(!a.fn.mark||!a.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"==typeof e?e:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}initMarkListener(){let t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",e=(t+=" responsive-display.dt.dth",null);this.instance.on(t,()=>{this.instance.rows({filter:"applied",page:"current"}).nodes().length>this.intervalThreshold?(clearTimeout(e),e=setTimeout(()=>{this.mark()},this.intervalMs)):this.mark()}),this.instance.on("destroy",()=>{this.instance.off(t)}),this.mark()}mark(){const s=this.instance.search();var t=a(this.instance.table().body());t.unmark(this.options),this.instance.table().rows({search:"applied"}).data().length&&t.mark(s,this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each((t,e)=>{const n=this.instance.column(e).search(),i=n||s;i&&t.forEach(t=>{a(t).unmark(this.options).mark(i,this.options)})})}}return a(e).on("init.dt.dth",(e,n)=>{if("dt"===e.namespace){e=new i.Api(n);let t=!1;e.init().mark?t=e.init().mark:i.defaults.mark&&(t=i.defaults.mark),t&&new s(e,t)}}),i}); \ No newline at end of file +!function(n){var i,s;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(i=require("jquery"),s=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),s(t,e),n(e,0,t.document)}:(s(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(a,t,e){"use strict";var i=a.fn.dataTable;class s{instance;options;intervalThreshold;intervalMs;constructor(t,e){if(!a.fn.mark||!a.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"==typeof e?e:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}initMarkListener(){let t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",e=(t+=" responsive-display.dt.dth",null);this.instance.on(t,()=>{this.instance.rows({filter:"applied",page:"current"}).nodes().length>this.intervalThreshold?(clearTimeout(e),e=setTimeout(()=>{this.mark()},this.intervalMs)):this.mark()}),this.instance.on("destroy",()=>{this.instance.off(t)}),this.mark()}mark(){const s=this.instance.search();var t=a(this.instance.table().body());t.unmark(this.options),this.instance.table().rows({search:"applied"}).data().length&&t.mark(s,this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each((t,e)=>{const n=this.instance.column(e).search(),i=n||s;i&&t.forEach(t=>{a(t).unmark(this.options).mark(i,this.options)})})}}return a(e).on("init.dt.dth",(e,n)=>{if("dt"===e.namespace){e=new i.Api(n);let t=!1;e.init().mark?t=e.init().mark:i.defaults.mark&&(t=i.defaults.mark),t&&new s(e,t)}}),i}); \ No newline at end of file diff --git a/features/pageResize/dataTables.pageResize.min.js b/features/pageResize/dataTables.pageResize.min.js index 8940e5ee..8df8fbf1 100644 --- a/features/pageResize/dataTables.pageResize.min.js +++ b/features/pageResize/dataTables.pageResize.min.js @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -!function(i){var o,s;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return i(e,window,document)}):"object"==typeof exports?(o=require("jquery"),s=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||o(e),s(e,t),i(t,0,e.document)}:(s(window,o),module.exports=i(o,window,window.document))):i(jQuery,window,document)}(function(f,e,t,i){"use strict";function o(e,t){var i=e.table();this.s={dt:e,host:f(i.container()).parent(),header:f(i.header()),footer:f(i.footer()),body:f(i.body()),container:f(i.container()),table:f(i.node()),delta:t},this.sizes={offsetTop:this._getOffsetTop(),tableHeight:this._getTableHeight(),containerHeight:this._getContainerHeight(),headerHeight:this._getHeaderHeight(),footerHeight:this._getFooterHeight()};"static"===(i=this.s.host).css("position")&&i.css("position","relative");var o=function(){e.off(".pageResize",o),this.s.obj&&this.s.obj.remove()}.bind(this),s=(e.on("destroy.pageResize",o),this._attach(),"init.pageResize");e.on(s,function(){e.off(s),this._size()}.bind(this))}var s=f.fn.dataTable;return o.prototype={_size:function(){var e=this.s,t=e.dt,i=t.table(),o=f("tr",e.body),o=o.eq(1").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html");e[0].onload=function(){var e=this.contentDocument,t=e.body,i=t.offsetHeight;e.defaultView.onresize=function(){var e=t.clientHeight||t.offsetHeight;e!==i?(i=e,o._size()):o.sizes.offsetTop===o._getOffsetTop()&&o.sizes.containerHeight===o._getContainerHeight()&&o.sizes.tableHeight===o._getTableHeight()&&o.sizes.headerHeight===o._getHeaderHeight()&&o.sizes.footerHeight===o._getFooterHeight()||o._size()}},e.appendTo(this.s.host).attr("data","about:blank"),this.s.obj=e},_getOffsetTop:function(){return f(this.s.table).offset().top},_getTableHeight:function(){return this.s.table.height()},_getContainerHeight:function(){return this.s.container.height()},_getHeaderHeight:function(){return this.s.dt.table().header()?this.s.header.height():0},_getFooterHeight:function(){return this.s.dt.table().footer()?this.s.footer.height():0}},s.PageResize=o,f(t).on("preInit.dt",function(e,t){"dt"===e.namespace&&(e=new s.Api(t),f(e.table().node()).hasClass("pageResize")||t.oInit.pageResize||s.defaults.pageResize)&&new o(e,t.oInit.pageResizeManualDelta)}),s}); \ No newline at end of file +!function(i){var o,s;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return i(e,window,document)}):"object"==typeof exports?(o=require("jquery"),s=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||o(e),s(e,t),i(t,0,e.document)}:(s(window,o),module.exports=i(o,window,window.document))):i(jQuery,window,document)}(function(f,e,t){"use strict";function i(e,t){var i=e.table();this.s={dt:e,host:f(i.container()).parent(),header:f(i.header()),footer:f(i.footer()),body:f(i.body()),container:f(i.container()),table:f(i.node()),delta:t},this.sizes={offsetTop:this._getOffsetTop(),tableHeight:this._getTableHeight(),containerHeight:this._getContainerHeight(),headerHeight:this._getHeaderHeight(),footerHeight:this._getFooterHeight()};"static"===(i=this.s.host).css("position")&&i.css("position","relative");var o=function(){e.off(".pageResize",o),this.s.obj&&this.s.obj.remove()}.bind(this),s=(e.on("destroy.pageResize",o),this._attach(),"init.pageResize");e.on(s,function(){e.off(s),this._size()}.bind(this))}var o=f.fn.dataTable;return i.prototype={_size:function(){var e=this.s,t=e.dt,i=t.table(),o=f("tr",e.body),o=o.eq(1").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html");e[0].onload=function(){var e=this.contentDocument,t=e.body,i=t.offsetHeight;e.defaultView.onresize=function(){var e=t.clientHeight||t.offsetHeight;e!==i?(i=e,o._size()):o.sizes.offsetTop===o._getOffsetTop()&&o.sizes.containerHeight===o._getContainerHeight()&&o.sizes.tableHeight===o._getTableHeight()&&o.sizes.headerHeight===o._getHeaderHeight()&&o.sizes.footerHeight===o._getFooterHeight()||o._size()}},e.appendTo(this.s.host).attr("data","about:blank"),this.s.obj=e},_getOffsetTop:function(){return f(this.s.table).offset().top},_getTableHeight:function(){return this.s.table.height()},_getContainerHeight:function(){return this.s.container.height()},_getHeaderHeight:function(){return this.s.dt.table().header()?this.s.header.height():0},_getFooterHeight:function(){return this.s.dt.table().footer()?this.s.footer.height():0}},o.PageResize=i,f(t).on("preInit.dt",function(e,t){"dt"===e.namespace&&(e=new o.Api(t),f(e.table().node()).hasClass("pageResize")||t.oInit.pageResize||o.defaults.pageResize)&&new i(e,t.oInit.pageResizeManualDelta)}),o}); \ No newline at end of file diff --git a/features/pageResize/index.html b/features/pageResize/index.html index 344d70f6..62804ad0 100644 --- a/features/pageResize/index.html +++ b/features/pageResize/index.html @@ -5,7 +5,7 @@ DataTables page resize example - + - - + + - + + - + + - + + + + + + + +
+
+

DataTables example SearchFade

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSydney232010/09/20$85,600
Angelica RamosChief Executive Officer (CEO)London472009/10/09$1,200,000
Gavin JoyceDeveloperEdinburgh422010/12/22$92,575
Jennifer ChangRegional DirectorSingapore282010/11/14$357,650
Brenden WagnerSoftware EngineerSan Francisco282011/06/07$206,850
Fiona GreenChief Operating Officer (COO)San Francisco482010/03/11$850,000
Shou ItouRegional MarketingTokyo202011/08/14$163,000
Michelle HouseIntegration SpecialistSydney372011/06/02$95,400
Suki BurksDeveloperLondon532009/10/22$114,500
Prescott BartlettTechnical AuthorLondon272011/05/07$145,000
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
Howard HatfieldOffice ManagerSan Francisco512008/12/16$164,500
Hope FuentesSecretarySan Francisco412010/02/12$109,850
Vivian HarrellFinancial ControllerSan Francisco622009/02/14$452,500
Timothy MooneyOffice ManagerLondon372008/12/11$136,200
Jackson BradshawDirectorNew York652008/09/26$645,750
Olivia LiangSupport EngineerSingapore642011/02/03$234,500
Bruno NashSoftware EngineerLondon382011/05/03$163,500
Sakura YamamotoSupport EngineerTokyo372009/08/19$139,575
Thor WaltonDeveloperNew York612013/08/11$98,540
Finn CamachoSupport EngineerSan Francisco472009/07/07$87,500
Serge BaldwinData CoordinatorSingapore642012/04/09$138,575
Zenaida FrankSoftware EngineerNew York632010/01/04$125,250
Zorita SerranoSoftware EngineerSan Francisco562012/06/01$115,000
Jennifer AcostaJunior Javascript DeveloperEdinburgh432013/02/01$75,650
Cara StevensSales AssistantNew York462011/12/06$145,600
Hermione ButlerRegional DirectorLondon472011/03/21$356,250
Lael GreerSystems AdministratorLondon212009/02/27$103,500
Jonas AlexanderDeveloperSan Francisco302010/07/14$86,500
Shad DeckerRegional DirectorEdinburgh512008/11/13$183,000
Michael BruceJavascript DeveloperSingapore292011/06/27$183,000
Donna SniderCustomer SupportNew York272011/01/25$112,000
NamePositionOfficeAgeStart dateSalary
+
+

The Javascript shown below is used to initialise the table shown in this example:

+ +$(document).ready(function() { + var table = $('#example').DataTable({ + layout: { + topEnd: 'searchFade' + } + }); +} ); +
+ + + diff --git a/features/searchFade/src/dataTables.searchFade.ts b/features/searchFade/src/dataTables.searchFade.ts index 3f93695f..530903d6 100644 --- a/features/searchFade/src/dataTables.searchFade.ts +++ b/features/searchFade/src/dataTables.searchFade.ts @@ -7,11 +7,14 @@ * This source file is free software, available under the following license: * MIT license - http://datatables.net/license/mit * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net + * This feature will fade out rows which don't match from the input + * + * @example + * $('#myTable').DataTable( { + * layout: { + * topStart: 'searchFade; + * } + * } ); */ import $ from 'jquery'; @@ -38,6 +41,10 @@ declare module 'datatables.net' { interface ApiSearchFadeMethods extends Api { node(): JQuery | null; } + + interface Feature { + searchFade?: {} + } } DataTable.Api.register('searchFade()', function () { @@ -105,6 +112,12 @@ DataTable.ext.feature.push({ cFeature: 'F', }); +DataTable.feature.register('searchFade', function (settings) { + var search = new DataTable.SearchFade(settings); + return search.node(); +}); + + $(document).on('init.dt', function (e, settings) { if (e.namespace !== 'dt') { return; diff --git a/features/searchHighlight/dataTables.searchHighlight.min.js b/features/searchHighlight/dataTables.searchHighlight.min.js index 8847142e..5091ae4f 100644 --- a/features/searchHighlight/dataTables.searchHighlight.min.js +++ b/features/searchHighlight/dataTables.searchHighlight.min.js @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -!function(n){var i,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(i=require("jquery"),o=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),o(t,e),n(e,0,t.document)}:(o(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(d,t,e,n){"use strict";var a=d.fn.dataTable;function r(t,e){t.unhighlight(),e.rows({filter:"applied"}).data().length&&(e.columns().every(function(){var t=this;t.nodes().flatten().to$().unhighlight({className:"column_highlight"}),t.nodes().flatten().to$().highlight(t.search().trim().split(/\s+/),{className:"column_highlight"})}),t.highlight(e.search().trim().split(/\s+/)))}return d(e).on("init.dt.dth",function(t,e,n){var i,o;"dt"===t.namespace&&(i=new a.Api(e),o=d(i.table().body()),d(i.table().node()).hasClass("searchHighlight")||e.oInit.searchHighlight||a.defaults.searchHighlight)&&(i.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){r(o,i)}).on("destroy",function(){i.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}),i.search())&&r(o,i)}),a}); \ No newline at end of file +!function(n){var i,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(i=require("jquery"),o=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),o(t,e),n(e,0,t.document)}:(o(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(d,t,e){"use strict";var a=d.fn.dataTable;function r(t,e){t.unhighlight(),e.rows({filter:"applied"}).data().length&&(e.columns().every(function(){var t=this;t.nodes().flatten().to$().unhighlight({className:"column_highlight"}),t.nodes().flatten().to$().highlight(t.search().trim().split(/\s+/),{className:"column_highlight"})}),t.highlight(e.search().trim().split(/\s+/)))}return d(e).on("init.dt.dth",function(t,e,n){var i,o;"dt"===t.namespace&&(i=new a.Api(e),o=d(i.table().body()),d(i.table().node()).hasClass("searchHighlight")||e.oInit.searchHighlight||a.defaults.searchHighlight)&&(i.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){r(o,i)}).on("destroy",function(){i.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}),i.search())&&r(o,i)}),a}); \ No newline at end of file diff --git a/features/searchHighlight/index.html b/features/searchHighlight/index.html new file mode 100644 index 00000000..70fea107 --- /dev/null +++ b/features/searchHighlight/index.html @@ -0,0 +1,524 @@ + + + + + + + + DataTables example - Fuzzy Searching + + + + + + + + + + +
+
+

DataTables example Search Highlight

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSydney232010/09/20$85,600
Angelica RamosChief Executive Officer (CEO)London472009/10/09$1,200,000
Gavin JoyceDeveloperEdinburgh422010/12/22$92,575
Jennifer ChangRegional DirectorSingapore282010/11/14$357,650
Brenden WagnerSoftware EngineerSan Francisco282011/06/07$206,850
Fiona GreenChief Operating Officer (COO)San Francisco482010/03/11$850,000
Shou ItouRegional MarketingTokyo202011/08/14$163,000
Michelle HouseIntegration SpecialistSydney372011/06/02$95,400
Suki BurksDeveloperLondon532009/10/22$114,500
Prescott BartlettTechnical AuthorLondon272011/05/07$145,000
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
Howard HatfieldOffice ManagerSan Francisco512008/12/16$164,500
Hope FuentesSecretarySan Francisco412010/02/12$109,850
Vivian HarrellFinancial ControllerSan Francisco622009/02/14$452,500
Timothy MooneyOffice ManagerLondon372008/12/11$136,200
Jackson BradshawDirectorNew York652008/09/26$645,750
Olivia LiangSupport EngineerSingapore642011/02/03$234,500
Bruno NashSoftware EngineerLondon382011/05/03$163,500
Sakura YamamotoSupport EngineerTokyo372009/08/19$139,575
Thor WaltonDeveloperNew York612013/08/11$98,540
Finn CamachoSupport EngineerSan Francisco472009/07/07$87,500
Serge BaldwinData CoordinatorSingapore642012/04/09$138,575
Zenaida FrankSoftware EngineerNew York632010/01/04$125,250
Zorita SerranoSoftware EngineerSan Francisco562012/06/01$115,000
Jennifer AcostaJunior Javascript DeveloperEdinburgh432013/02/01$75,650
Cara StevensSales AssistantNew York462011/12/06$145,600
Hermione ButlerRegional DirectorLondon472011/03/21$356,250
Lael GreerSystems AdministratorLondon212009/02/27$103,500
Jonas AlexanderDeveloperSan Francisco302010/07/14$86,500
Shad DeckerRegional DirectorEdinburgh512008/11/13$183,000
Michael BruceJavascript DeveloperSingapore292011/06/27$183,000
Donna SniderCustomer SupportNew York272011/01/25$112,000
NamePositionOfficeAgeStart dateSalary
+
+

The Javascript shown below is used to initialise the table shown in this example:

$(document).ready(function() { + var table = $('#example').DataTable({ + searchHighlight: true + }); +} ); +
+ + + diff --git a/features/slidingChild/dataTables.slidingChild.min.js b/features/slidingChild/dataTables.slidingChild.min.js index 121fa6fe..7ee1105a 100644 --- a/features/slidingChild/dataTables.slidingChild.min.js +++ b/features/slidingChild/dataTables.slidingChild.min.js @@ -1,2 +1,2 @@ /*! © Nick Adkinson, SpryMedia Ltd - datatables.net/license */ -!function(t){var n,e;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(i){return t(i,window,document)}):"object"==typeof exports?(n=require("jquery"),e=function(i,o){o.fn.dataTable||require("datatables.net")(i,o)},"undefined"==typeof window?module.exports=function(i,o){return i=i||window,o=o||n(i),e(i,o),t(o,0,i.document)}:(e(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(d,i,s,o){"use strict";function a(i,o){var t=this,n=(i.on("draw",function(){t._updateFadedRows()}),i.table()),e=s.createElement("div");e.className="slider",this.s=d.extend({},{dt:i,table:d(n.node()),slider:d(e)},a.defaults,o),this._bind()}var t=d.fn.dataTable;a.prototype._bind=function(){var o=this,t=o.s;d(t.table,"> tbody").on("click",t.selector,function(){var i=d(this),i=i.is("tr")?i:i.closest("tr");i.is("tr")&&(i=t.dt.row(i),o._toggleChild(i))})},a.prototype._toggleChild=function(i){var o,t=this.s;i.child.isShown()?this._hideChild(i,function(){}):(o=t.dt.row(".shown")).length&&t.toggle?this._hideChild(o,this._showChildCallback(i)):this._showChild(i)},a.prototype._showChildCallback=function(i){return function(i){this._showChild(i)}.bind(this,i)},a.prototype._showChild=function(i){var o=d(i.node());this.s.displayLoadingIndicator&&this._addLoadingIndicator(o),this.s.source(o,this._response(i))},a.prototype._response=function(i){return function(i,o){this.__showChild(i,o)}.bind(this,i)},a.prototype.__showChild=function(i,o){var t=this.s,n=t.slider,e=d(i.node());t.displayLoadingIndicator&&d("."+this.s.loadingIndicatorClass).remove(),n.append(o),i.child(n,t.childClass).show(),e.toggleClass("shown"),this._updateFadedRows(),t.animateShow?this._showChildWithAnimation(i):this._showChildWithoutAnimation(i)},a.prototype._showChildWithAnimation=function(i){var o=this.s;d(o.slider,i.child()).slideDown(o.animationSpeed,function(){o.onShown(i)})},a.prototype._showChildWithoutAnimation=function(i){var o=this.s;d(o.slider,i.child()).show(),o.onShown(i)},a.prototype._hideChild=function(i,o){var t=this.s;d(i.node()).toggleClass("shown"),this._updateFadedRows(),t.animateHide?this._hideChildWithAnimation(i,o):this._hideChildWithoutAnimation(i,o)},a.prototype._hideChildWithAnimation=function(i,o){var t=this.s,n=t.slider;d(n,i.child()).slideUp(t.animationSpeed,function(){i.child.remove(),n.empty(),t.onHidden(i),o()})},a.prototype._hideChildWithoutAnimation=function(i,o){var t=this.s,n=t.slider;d(n,i.child()).hide(),i.child.remove(),n.empty(),t.onHidden(i),o()},a.prototype._updateFadedRows=function(){this.s.fadeNonShowingRows?(this._fadeNonShowingRows(),this._removeFadeFromShowingRows()):this._removeFadeFromRows()},a.prototype._fadeNonShowingRows=function(){this.s.dt.rows(".shown:visible").count()?this.s.dt.rows(":visible:not(.shown):not(.faded)").nodes().to$().css("opacity",this.s.fadeOpacity).addClass("faded"):this._removeFadeFromRows()},a.prototype._removeFadeFromShowingRows=function(){this.s.dt.rows(".shown.faded:visible").nodes().to$().css("opacity",1).removeClass("faded")},a.prototype._removeFadeFromRows=function(){this.s.dt.rows(".faded").nodes().to$().css("opacity",1).removeClass("faded")},a.prototype._addLoadingIndicator=function(i){var o=i.position(),t=d(this.s.loadingIndicatorContent);t.addClass(this.s.loadingIndicatorClass),t.css("top",o.top),t.css("left",o.left),t.css("height",i.height()),i.append(t)};return a.defaults={selector:"tr",childClass:"child",source:function(){},toggle:!0,animateShow:!0,animateHide:!0,fadeNonShowingRows:!1,fadeOpacity:.4,animationSpeed:200,onShown:function(){},onHidden:function(){},displayLoadingIndicator:!1,loadingIndicatorClass:"loading-indicator",loadingIndicatorContent:'
Loading...
'},t.SlidingChild=a,d(s).on("init.dt",function(i,o){"dt"===i.namespace&&(i=new t.Api(o),d(i.table().node()).hasClass("slidingChild")||o.oInit.slidingChild||t.defaults.slidingChild)&&new a(i,o.oInit.slidingChild)}),t}); \ No newline at end of file +!function(t){var n,e;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(i){return t(i,window,document)}):"object"==typeof exports?(n=require("jquery"),e=function(i,o){o.fn.dataTable||require("datatables.net")(i,o)},"undefined"==typeof window?module.exports=function(i,o){return i=i||window,o=o||n(i),e(i,o),t(o,0,i.document)}:(e(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(d,i,s){"use strict";function a(i,o){var t=this,n=(i.on("draw",function(){t._updateFadedRows()}),i.table()),e=s.createElement("div");e.className="slider",this.s=d.extend({},{dt:i,table:d(n.node()),slider:d(e)},a.defaults,o),this._bind()}var t=d.fn.dataTable;a.prototype._bind=function(){var o=this,t=o.s;d(t.table,"> tbody").on("click",t.selector,function(){var i=d(this),i=i.is("tr")?i:i.closest("tr");i.is("tr")&&(i=t.dt.row(i),o._toggleChild(i))})},a.prototype._toggleChild=function(i){var o,t=this.s;i.child.isShown()?this._hideChild(i,function(){}):(o=t.dt.row(".shown")).length&&t.toggle?this._hideChild(o,this._showChildCallback(i)):this._showChild(i)},a.prototype._showChildCallback=function(i){return function(i){this._showChild(i)}.bind(this,i)},a.prototype._showChild=function(i){var o=d(i.node());this.s.displayLoadingIndicator&&this._addLoadingIndicator(o),this.s.source(o,this._response(i))},a.prototype._response=function(i){return function(i,o){this.__showChild(i,o)}.bind(this,i)},a.prototype.__showChild=function(i,o){var t=this.s,n=t.slider,e=d(i.node());t.displayLoadingIndicator&&d("."+this.s.loadingIndicatorClass).remove(),n.append(o),i.child(n,t.childClass).show(),e.toggleClass("shown"),this._updateFadedRows(),t.animateShow?this._showChildWithAnimation(i):this._showChildWithoutAnimation(i)},a.prototype._showChildWithAnimation=function(i){var o=this.s;d(o.slider,i.child()).slideDown(o.animationSpeed,function(){o.onShown(i)})},a.prototype._showChildWithoutAnimation=function(i){var o=this.s;d(o.slider,i.child()).show(),o.onShown(i)},a.prototype._hideChild=function(i,o){var t=this.s;d(i.node()).toggleClass("shown"),this._updateFadedRows(),t.animateHide?this._hideChildWithAnimation(i,o):this._hideChildWithoutAnimation(i,o)},a.prototype._hideChildWithAnimation=function(i,o){var t=this.s,n=t.slider;d(n,i.child()).slideUp(t.animationSpeed,function(){i.child.remove(),n.empty(),t.onHidden(i),o()})},a.prototype._hideChildWithoutAnimation=function(i,o){var t=this.s,n=t.slider;d(n,i.child()).hide(),i.child.remove(),n.empty(),t.onHidden(i),o()},a.prototype._updateFadedRows=function(){this.s.fadeNonShowingRows?(this._fadeNonShowingRows(),this._removeFadeFromShowingRows()):this._removeFadeFromRows()},a.prototype._fadeNonShowingRows=function(){this.s.dt.rows(".shown:visible").count()?this.s.dt.rows(":visible:not(.shown):not(.faded)").nodes().to$().css("opacity",this.s.fadeOpacity).addClass("faded"):this._removeFadeFromRows()},a.prototype._removeFadeFromShowingRows=function(){this.s.dt.rows(".shown.faded:visible").nodes().to$().css("opacity",1).removeClass("faded")},a.prototype._removeFadeFromRows=function(){this.s.dt.rows(".faded").nodes().to$().css("opacity",1).removeClass("faded")},a.prototype._addLoadingIndicator=function(i){var o=i.position(),t=d(this.s.loadingIndicatorContent);t.addClass(this.s.loadingIndicatorClass),t.css("top",o.top),t.css("left",o.left),t.css("height",i.height()),i.append(t)};return a.defaults={selector:"tr",childClass:"child",source:function(){},toggle:!0,animateShow:!0,animateHide:!0,fadeNonShowingRows:!1,fadeOpacity:.4,animationSpeed:200,onShown:function(){},onHidden:function(){},displayLoadingIndicator:!1,loadingIndicatorClass:"loading-indicator",loadingIndicatorContent:'
Loading...
'},t.SlidingChild=a,d(s).on("init.dt",function(i,o){"dt"===i.namespace&&(i=new t.Api(o),d(i.table().node()).hasClass("slidingChild")||o.oInit.slidingChild||t.defaults.slidingChild)&&new a(i,o.oInit.slidingChild)}),t}); \ No newline at end of file diff --git a/make.sh b/make.sh index cbd1ea8d..39d91c98 100755 --- a/make.sh +++ b/make.sh @@ -105,14 +105,14 @@ PLUGINS="${DT_SRC}/extensions/Plugins" # ts_plugin $file # done -# for file in $PLUGINS/features/*/src/*.ts; do -# ts_plugin $file -# done - -for file in $PLUGINS/sorting/src/*.ts; do +for file in $PLUGINS/features/*/src/*.ts; do ts_plugin $file done +# for file in $PLUGINS/sorting/src/*.ts; do +# ts_plugin $file +# done + # for file in $PLUGINS/type-detection/src/*.ts; do # ts_plugin $file # done