fix for dynamic tables extra space

pull/776/head
razvanaldea89 2019-02-22 13:28:26 +02:00
parent 86a809dca4
commit d04162d338
3 changed files with 355 additions and 344 deletions

View File

@ -14,6 +14,7 @@
return function debounced() {
var obj = this, args = arguments;
function delayed() {
if (!execAsap)
func.apply(obj, args);
@ -30,42 +31,9 @@
};
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery,'smartresize');
/**
* Resize function without multiple trigger
*
* Usage:
* $(window).smartresize(function(){
* // code here
* });
*/
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
}
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
jQuery.fn[sr] = function (fn) {
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
};
};
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery, 'smartresize');
/**
@ -75,6 +43,9 @@
*/
/* SIDEBAR */
// fix for dynamic tables
function setContentHeight() {
var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
$BODY = $("body"),
$MENU_TOGGLE = $("#menu_toggle"),
@ -88,7 +59,7 @@ var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
return Math.floor(21 * Math.random()) + 20
};
var setContentHeight = function () {
// reset height
$RIGHT_COL.css('min-height', $(window).height());
var bodyHeight = $BODY.outerHeight(),
@ -101,9 +72,20 @@ var setContentHeight = function () {
$RIGHT_COL.css('min-height', contentHeight);
};
/* SIDEBAR */
$(document).ready(function () {
var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
$BODY = $("body"),
$MENU_TOGGLE = $("#menu_toggle"),
$SIDEBAR_MENU = $("#sidebar-menu"),
$SIDEBAR_FOOTER = $(".sidebar-footer"),
$LEFT_COL = $(".left_col"),
$RIGHT_COL = $(".right_col"),
$NAV_MENU = $(".nav_menu"),
$FOOTER = $("footer"),
randNum = function () {
return Math.floor(21 * Math.random()) + 20
};
$SIDEBAR_MENU.find('a').on('click', function (ev) {
var $li = $(this).parent();
@ -118,17 +100,13 @@ $(document).ready(function() {
$('.left_col.menu_fixed > .mCustomScrollBox > .mCSB_container ').css('min-height', '0');
}
});
}
else
{
} else {
// prevent closing menu if we are on child menu
if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp();
}else
{
if ( $BODY.is( ".nav-sm" ) )
{
} else {
if ($BODY.is(".nav-sm")) {
if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp();
@ -187,9 +165,11 @@ $(document).ready(function() {
$BODY.toggleClass('nav-md nav-sm');
setContentHeight();
$('.dataTable').each(function () {
$(this).dataTable().fnDraw();
});
$('.dataTable').each ( function () { $(this).dataTable().fnDraw(); });
setContentHeight();
});
// check active menu
@ -234,7 +214,6 @@ $(document).ready(function() {
}
});
/* SIDEBAR - end */
function countChecked() {
@ -924,7 +903,8 @@ function init_parsley() {
};
try {
hljs.initHighlightingOnLoad()
} catch (a) {}
} catch (a) {
}
}
}
@ -962,6 +942,7 @@ function init_wysiwyg() {
var c = "";
"unsupported-file-type" === a ? c = "Unsupported format " + b : console.log("error uploading file", a, b), $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button><strong>File upload error</strong> ' + c + " </div>").prependTo("#alerts")
}
"undefined" != typeof $.fn.wysiwyg && (console.log("init_wysiwyg"), $(".editor-wrapper").each(function () {
var a = $(this).attr("id");
$(this).wysiwyg({
@ -1071,7 +1052,8 @@ function init_cropper() {
function init_knob() {
if ("undefined" != typeof $.fn.knob) {
console.log("init_knob"), $(".knob").knob({
change: function(a) {},
change: function (a) {
},
release: function (a) {
console.log("release : " + a)
},
@ -1420,7 +1402,8 @@ function init_EasyPieChart() {
});
var b = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) {
var d, e, c = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
var d, e,
c = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
b.call(this, a), a.currentTarget && (d = $(a.currentTarget).siblings(".popover"), e = c.timeout, d.one("mouseenter", function () {
clearTimeout(e), d.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(c, c)
@ -1858,6 +1841,8 @@ function init_DataTables() {
})
}), TableManageButtons.init()
}
//fix for dynamic tables
setContentHeight();
}
function init_morris_charts() {
@ -4262,13 +4247,16 @@ function init_echarts() {
})
}
}
}! function(a, b) {
}
!function (a, b) {
var c = function (a, b, c) {
var d;
return function () {
function h() {
c || a.apply(f, g), d = null
}
var f = this,
g = arguments;
d ? clearTimeout(d) : c && a.apply(f, g), d = setTimeout(h, b || 100)
@ -4336,7 +4324,8 @@ $(".bulk_action input").on("ifChecked", function() {
}));
var originalLeave = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) {
var c, d, b = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
var c, d,
b = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
originalLeave.call(this, a), a.currentTarget && (c = $(a.currentTarget).siblings(".popover"), d = b.timeout, c.one("mouseenter", function () {
clearTimeout(d), c.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(b, b)
@ -4384,4 +4373,3 @@ $.fn.popover.Constructor.prototype.leave = function(a) {
init_autosize(),
init_autocomplete()
});

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,7 @@
return function debounced() {
var obj = this, args = arguments;
function delayed() {
if (!execAsap)
func.apply(obj, args);
@ -30,7 +31,9 @@
};
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
jQuery.fn[sr] = function (fn) {
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
};
})(jQuery, 'smartresize');
/**
@ -40,6 +43,9 @@
*/
/* SIDEBAR */
// fix for dynamic tables
function setContentHeight() {
var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
$BODY = $("body"),
$MENU_TOGGLE = $("#menu_toggle"),
@ -53,7 +59,7 @@ var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
return Math.floor(21 * Math.random()) + 20
};
var setContentHeight = function () {
// reset height
$RIGHT_COL.css('min-height', $(window).height());
var bodyHeight = $BODY.outerHeight(),
@ -66,9 +72,20 @@ var setContentHeight = function () {
$RIGHT_COL.css('min-height', contentHeight);
};
/* SIDEBAR */
$(document).ready(function () {
var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
$BODY = $("body"),
$MENU_TOGGLE = $("#menu_toggle"),
$SIDEBAR_MENU = $("#sidebar-menu"),
$SIDEBAR_FOOTER = $(".sidebar-footer"),
$LEFT_COL = $(".left_col"),
$RIGHT_COL = $(".right_col"),
$NAV_MENU = $(".nav_menu"),
$FOOTER = $("footer"),
randNum = function () {
return Math.floor(21 * Math.random()) + 20
};
$SIDEBAR_MENU.find('a').on('click', function (ev) {
var $li = $(this).parent();
@ -83,17 +100,13 @@ $(document).ready(function() {
$('.left_col.menu_fixed > .mCustomScrollBox > .mCSB_container ').css('min-height', '0');
}
});
}
else
{
} else {
// prevent closing menu if we are on child menu
if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp();
}else
{
if ( $BODY.is( ".nav-sm" ) )
{
} else {
if ($BODY.is(".nav-sm")) {
if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp();
@ -152,9 +165,11 @@ $(document).ready(function() {
$BODY.toggleClass('nav-md nav-sm');
setContentHeight();
$('.dataTable').each(function () {
$(this).dataTable().fnDraw();
});
$('.dataTable').each ( function () { $(this).dataTable().fnDraw(); });
setContentHeight();
});
// check active menu
@ -199,7 +214,6 @@ $(document).ready(function() {
}
});
/* SIDEBAR - end */
function countChecked() {
@ -889,7 +903,8 @@ function init_parsley() {
};
try {
hljs.initHighlightingOnLoad()
} catch (a) {}
} catch (a) {
}
}
}
@ -927,6 +942,7 @@ function init_wysiwyg() {
var c = "";
"unsupported-file-type" === a ? c = "Unsupported format " + b : console.log("error uploading file", a, b), $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button><strong>File upload error</strong> ' + c + " </div>").prependTo("#alerts")
}
"undefined" != typeof $.fn.wysiwyg && (console.log("init_wysiwyg"), $(".editor-wrapper").each(function () {
var a = $(this).attr("id");
$(this).wysiwyg({
@ -1036,7 +1052,8 @@ function init_cropper() {
function init_knob() {
if ("undefined" != typeof $.fn.knob) {
console.log("init_knob"), $(".knob").knob({
change: function(a) {},
change: function (a) {
},
release: function (a) {
console.log("release : " + a)
},
@ -1385,7 +1402,8 @@ function init_EasyPieChart() {
});
var b = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) {
var d, e, c = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
var d, e,
c = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
b.call(this, a), a.currentTarget && (d = $(a.currentTarget).siblings(".popover"), e = c.timeout, d.one("mouseenter", function () {
clearTimeout(e), d.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(c, c)
@ -1823,6 +1841,8 @@ function init_DataTables() {
})
}), TableManageButtons.init()
}
//fix for dynamic tables
setContentHeight();
}
function init_morris_charts() {
@ -4227,13 +4247,16 @@ function init_echarts() {
})
}
}
}! function(a, b) {
}
!function (a, b) {
var c = function (a, b, c) {
var d;
return function () {
function h() {
c || a.apply(f, g), d = null
}
var f = this,
g = arguments;
d ? clearTimeout(d) : c && a.apply(f, g), d = setTimeout(h, b || 100)
@ -4301,7 +4324,8 @@ $(".bulk_action input").on("ifChecked", function() {
}));
var originalLeave = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) {
var c, d, b = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
var c, d,
b = a instanceof this.constructor ? a : $(a.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
originalLeave.call(this, a), a.currentTarget && (c = $(a.currentTarget).siblings(".popover"), d = b.timeout, c.one("mouseenter", function () {
clearTimeout(d), c.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(b, b)
@ -4349,4 +4373,3 @@ $.fn.popover.Constructor.prototype.leave = function(a) {
init_autosize(),
init_autocomplete()
});