You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/features/lengthLinks/dataTables.lengthLinks.min.mjs

2 lines
1.1 KiB
JavaScript

/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.LengthLinks=function(e){var r=new DataTable.Api(e),a=r.settings()[0],l=$("<div></div>").addClass("dt-lengthLinks"),i=null;this.container=function(){return l[0]},l.on("click.dtll","a",function(e){e.preventDefault(),r.page.len(+$(this).data("length")).draw(!1)}),r.on("draw",function(){var n,t,e;r.page.len()!==i&&(e=a.aLengthMenu,n=2===e.length&&Array.isArray(e[0])?e[1]:e,t=2===e.length&&Array.isArray(e[0])?e[0]:e,e=$.map(t,function(e,a){return e==r.page.len()?'<a class="active" data-length="'+t[a]+'">'+n[a]+"</a>":'<a data-length="'+t[a]+'">'+n[a]+"</a>"}),l.html(a.oLanguage.sLengthMenu.replace("_MENU_",e.join(" | ")).replace("_ENTRIES_",r.i18n("entries","",10))),i=r.page.len())}),r.on("destroy",function(){l.off("click.dtll","a")})},DataTable.ext.feature.push({fnInit:function(e){return new DataTable.LengthLinks(e).container()},cFeature:"L",sFeature:"LengthLinks"}),DataTable.feature.register("lengthLinks",function(e){return new DataTable.LengthLinks(e).container()});export default DataTable;