data tables remember pagination size preference
This commit is contained in:
@@ -58417,13 +58417,13 @@ jQuery.fn.dataTableExt.afnSortData['disco_datetime'] = function (oSettings, iCol
|
||||
$('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
|
||||
var d = $(this).children('span.date');
|
||||
if (d.length > 0)
|
||||
if (d.is('[data-livestamp]')){
|
||||
if (d.is('[data-livestamp]')) {
|
||||
aData.push((d.attr('data-livestamp')) * 1);
|
||||
} else if (d.data('livestampdata') !== undefined) {
|
||||
aData.push(d.data('livestampdata').moment.valueOf());
|
||||
}else{
|
||||
} else {
|
||||
aData.push(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
aData.push(-1);
|
||||
});
|
||||
@@ -58450,7 +58450,23 @@ jQuery.fn.dataTableExt.oSort['disco_datetime-desc'] = function (a, b) {
|
||||
|
||||
// Change Default Menu Lengths
|
||||
|
||||
jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, -1], [10, 20, 50, "All"]];
|
||||
jQuery.fn.DataTable.defaults.iDisplayLength = 20;
|
||||
if (window.localStorage) {
|
||||
var length = 20;
|
||||
var lengthString = window.localStorage.getItem('datatable_default_length');
|
||||
if (!!lengthString) {
|
||||
length = parseInt(lengthString);
|
||||
}
|
||||
jQuery.fn.DataTable.defaults.iDisplayLength = parseInt(length);
|
||||
jQuery.fn.DataTable.defaults.fnPreDrawCallback = function (oSettings) {
|
||||
var newLength = oSettings._iDisplayLength;
|
||||
if (length !== newLength) {
|
||||
window.localStorage.setItem('datatable_default_length', newLength)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, 100, 200, -1], [10, 20, 50, 100, 200, "All"]];
|
||||
(function ($, window, document, Modernizr) {
|
||||
|
||||
// Document Ready
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -10,13 +10,13 @@ jQuery.fn.dataTableExt.afnSortData['disco_datetime'] = function (oSettings, iCol
|
||||
$('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
|
||||
var d = $(this).children('span.date');
|
||||
if (d.length > 0)
|
||||
if (d.is('[data-livestamp]')){
|
||||
if (d.is('[data-livestamp]')) {
|
||||
aData.push((d.attr('data-livestamp')) * 1);
|
||||
} else if (d.data('livestampdata') !== undefined) {
|
||||
aData.push(d.data('livestampdata').moment.valueOf());
|
||||
}else{
|
||||
} else {
|
||||
aData.push(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
aData.push(-1);
|
||||
});
|
||||
@@ -43,4 +43,20 @@ jQuery.fn.dataTableExt.oSort['disco_datetime-desc'] = function (a, b) {
|
||||
|
||||
// Change Default Menu Lengths
|
||||
|
||||
jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, -1], [10, 20, 50, "All"]];
|
||||
jQuery.fn.DataTable.defaults.iDisplayLength = 20;
|
||||
if (window.localStorage) {
|
||||
var length = 20;
|
||||
var lengthString = window.localStorage.getItem('datatable_default_length');
|
||||
if (!!lengthString) {
|
||||
length = parseInt(lengthString);
|
||||
}
|
||||
jQuery.fn.DataTable.defaults.iDisplayLength = parseInt(length);
|
||||
jQuery.fn.DataTable.defaults.fnPreDrawCallback = function (oSettings) {
|
||||
var newLength = oSettings._iDisplayLength;
|
||||
if (length !== newLength) {
|
||||
window.localStorage.setItem('datatable_default_length', newLength)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, 100, 200, -1], [10, 20, 50, 100, 200, "All"]];
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"bPaginate": enablePaging,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": enableFilter,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
@@ -90,7 +89,6 @@
|
||||
"bPaginate": dataTableOptionsPagination,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
@@ -141,7 +139,6 @@
|
||||
"bPaginate": dataTableOptionsPagination,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
|
||||
@@ -1 +1 @@
|
||||
(function(n,t,i){var r=[];i(function(){function t(){var t=i(this).closest(".dataTables_wrapper");t.length>0&&n.setTimeout(function(){var e=i(n),o=t.height(),r=t.offset(),u=e.scrollTop(),s=e.height(),h=u-r.top,f;h>0?i("html").animate({scrollTop:r.top},125):(f=(u+s-(o+r.top))*-1,f>0&&(o>s?i("html").animate({scrollTop:r.top},125):i("html").animate({scrollTop:u+f},125)))},1)}i("table.jobTable").each(function(){var u=i(this),h=!1,l=u.hasClass("enablePaging"),a=u.hasClass("enableFilter"),v=u.find("tr").length>20,y={bPaginate:l,sPaginationType:"full_numbers",bLengthChange:v,iDisplayLength:20,bFilter:a,bSort:!0,bInfo:!1,bAutoWidth:!1,aoColumnDefs:[{aTargets:["dates"],sSortDataType:"disco_datetime",sType:"disco_datetime"}],aaSorting:[],oLanguage:{sSearch:"Filter:"},fnDrawCallback:function(){h?t.apply(u):h=!0}},p=u.dataTable(y),c,o,f,e,n,s;if(u.hasClass("hideStatusClosed")&&(c=u.children("tbody"),o=c.children('tr[data-status="Closed"]'),o.length>0)){f=i(this).closest(".dataTables_wrapper");e=f;f.parent(".jobTable").length>0&&(e=f.parent());n=e.prev();n.length>0&&(n.is("h1")||n.is("h2")||n.is("h3"))?n.data("dataTable_originalContent",n.html()).text("Active "+n.text()):n=null;s=e.find("div.allClosed_container");s.length>0?(u.hide(),f.find(".dataTables_filter").hide()):i('<a class="dataTables_showStatusClosed button small" href="#">').text("Show Closed Jobs ("+o.length+")").appendTo(e);e.on("click","a.dataTables_showStatusClosed",function(){return u.show(),f.find(".dataTables_filter").show(),u.removeClass("hideStatusClosed"),s.remove(),i(this).remove(),n&&n.html(n.data("dataTable_originalContent")),t.apply(u[0]),!1})}r.push(this)});i("table.deviceTable").each(function(){var n=i(this),u=n.find("tr").length>20,o={bPaginate:u,sPaginationType:"full_numbers",bLengthChange:u,iDisplayLength:20,bFilter:!0,bSort:!0,bInfo:!1,bAutoWidth:!1,aoColumnDefs:[{aTargets:["date"],sSortDataType:"disco_datetime",sType:"disco_datetime"}],aaSorting:[],oLanguage:{sSearch:"Filter:"}},s=n.children("tbody"),f=s.children("tr.decommissioned"),c=n.dataTable(o);if(f.length>0){var e=i(this).closest(".dataTables_wrapper"),h=i('<div class="dataTables_decommissioned"><label><input type="checkbox" /><span><\/span><\/label><\/div>').prependTo(e),l=h.find("span").text("Hide Decommissioned ("+f.length+")");e.on("change",".dataTables_decommissioned input",function(){var r=i(this);return r.is(":checked")?n.addClass("hideDecommissioned"):n.removeClass("hideDecommissioned"),t.apply(n[0]),!1})}r.push(this)});i("table.userTable").each(function(){var n=i(this),t=n.find("tr").length>20,u={bPaginate:t,sPaginationType:"full_numbers",bLengthChange:t,iDisplayLength:20,bFilter:!0,bSort:!0,bInfo:!1,bAutoWidth:!1,aaSorting:[],oLanguage:{sSearch:"Filter:"}};n.dataTable(u);r.push(this)})})})(window,document,$);
|
||||
(function(n,t,i){var r=[];i(function(){function t(){var t=i(this).closest(".dataTables_wrapper");t.length>0&&n.setTimeout(function(){var e=i(n),o=t.height(),r=t.offset(),u=e.scrollTop(),s=e.height(),h=u-r.top,f;h>0?i("html").animate({scrollTop:r.top},125):(f=(u+s-(o+r.top))*-1,f>0&&(o>s?i("html").animate({scrollTop:r.top},125):i("html").animate({scrollTop:u+f},125)))},1)}i("table.jobTable").each(function(){var u=i(this),h=!1,l=u.hasClass("enablePaging"),a=u.hasClass("enableFilter"),v=u.find("tr").length>20,y={bPaginate:l,sPaginationType:"full_numbers",bLengthChange:v,bFilter:a,bSort:!0,bInfo:!1,bAutoWidth:!1,aoColumnDefs:[{aTargets:["dates"],sSortDataType:"disco_datetime",sType:"disco_datetime"}],aaSorting:[],oLanguage:{sSearch:"Filter:"},fnDrawCallback:function(){h?t.apply(u):h=!0}},p=u.dataTable(y),c,o,f,e,n,s;if(u.hasClass("hideStatusClosed")&&(c=u.children("tbody"),o=c.children('tr[data-status="Closed"]'),o.length>0)){f=i(this).closest(".dataTables_wrapper");e=f;f.parent(".jobTable").length>0&&(e=f.parent());n=e.prev();n.length>0&&(n.is("h1")||n.is("h2")||n.is("h3"))?n.data("dataTable_originalContent",n.html()).text("Active "+n.text()):n=null;s=e.find("div.allClosed_container");s.length>0?(u.hide(),f.find(".dataTables_filter").hide()):i('<a class="dataTables_showStatusClosed button small" href="#">').text("Show Closed Jobs ("+o.length+")").appendTo(e);e.on("click","a.dataTables_showStatusClosed",function(){return u.show(),f.find(".dataTables_filter").show(),u.removeClass("hideStatusClosed"),s.remove(),i(this).remove(),n&&n.html(n.data("dataTable_originalContent")),t.apply(u[0]),!1})}r.push(this)});i("table.deviceTable").each(function(){var n=i(this),u=n.find("tr").length>20,o={bPaginate:u,sPaginationType:"full_numbers",bLengthChange:u,bFilter:!0,bSort:!0,bInfo:!1,bAutoWidth:!1,aoColumnDefs:[{aTargets:["date"],sSortDataType:"disco_datetime",sType:"disco_datetime"}],aaSorting:[],oLanguage:{sSearch:"Filter:"}},s=n.children("tbody"),f=s.children("tr.decommissioned"),c=n.dataTable(o);if(f.length>0){var e=i(this).closest(".dataTables_wrapper"),h=i('<div class="dataTables_decommissioned"><label><input type="checkbox" /><span><\/span><\/label><\/div>').prependTo(e),l=h.find("span").text("Hide Decommissioned ("+f.length+")");e.on("change",".dataTables_decommissioned input",function(){var r=i(this);return r.is(":checked")?n.addClass("hideDecommissioned"):n.removeClass("hideDecommissioned"),t.apply(n[0]),!1})}r.push(this)});i("table.userTable").each(function(){var n=i(this),t=n.find("tr").length>20,u={bPaginate:t,sPaginationType:"full_numbers",bLengthChange:t,bFilter:!0,bSort:!0,bInfo:!1,bAutoWidth:!1,aaSorting:[],oLanguage:{sSearch:"Filter:"}};n.dataTable(u);r.push(this)})})})(window,document,$);
|
||||
-3
@@ -14,7 +14,6 @@
|
||||
"bPaginate": enablePaging,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": enableFilter,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
@@ -90,7 +89,6 @@
|
||||
"bPaginate": dataTableOptionsPagination,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
@@ -141,7 +139,6 @@
|
||||
"bPaginate": dataTableOptionsPagination,
|
||||
"sPaginationType": "full_numbers",
|
||||
"bLengthChange": dataTableOptionsPagination,
|
||||
"iDisplayLength": 20,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": false,
|
||||
|
||||
Reference in New Issue
Block a user