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.js

26 lines
1.5 KiB
JavaScript

/*!
7 years ago
Copyright 2014 SpryMedia Ltd.
License MIT - http://datatables.net/license/mit
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.
@example
$('#myTable').DataTable( {
dom: 'Lfrtip'
} );
@example
$('#myTable').DataTable( {
lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ]
dom: 'Lfrtip'
} );
Page length control via links for DataTables
2014 SpryMedia Ltd - datatables.net/license
*/
7 years ago
(function(k,l,a,m){a.fn.dataTable.LengthLinks=function(d){var c=new a.fn.dataTable.Api(d),f=c.settings()[0],e=a("<div></div>").addClass(f.oClasses.sLength),h=null;this.container=function(){return e[0]};e.on("click.dtll","a",function(b){b.preventDefault();c.page.len(1*a(this).data("length")).draw(!1)});c.on("draw",function(){if(c.page.len()!==h){var b=f.aLengthMenu,d=2===b.length&&a.isArray(b[0])?b[1]:b,g=2===b.length&&a.isArray(b[0])?b[0]:b,b=a.map(g,function(b,a){return b==c.page.len()?'<a class="active" data-length="'+
g[a]+'">'+d[a]+"</a>":'<a data-length="'+g[a]+'">'+d[a]+"</a>"});e.html(f.oLanguage.sLengthMenu.replace("_MENU_",b.join(" | ")));h=c.page.len()}});c.on("destroy",function(){e.off("click.dtll","a")})};a.fn.dataTable.ext.feature.push({fnInit:function(d){return(new a.fn.dataTable.LengthLinks(d)).container()},cFeature:"L",sFeature:"LengthLinks"})})(window,document,jQuery);