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() { return function debounced() {
var obj = this, args = arguments; var obj = this, args = arguments;
function delayed() { function delayed() {
if (!execAsap) if (!execAsap)
func.apply(obj, args); func.apply(obj, args);
@ -30,42 +31,9 @@
}; };
// smartresize // 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');
/**
* 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);
}; };
};
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery, 'smartresize'); })(jQuery, 'smartresize');
/** /**
@ -75,6 +43,9 @@
*/ */
/* SIDEBAR */
// fix for dynamic tables
function setContentHeight() {
var CURRENT_URL = window.location.href.split("#")[0].split("?")[0], var CURRENT_URL = window.location.href.split("#")[0].split("?")[0],
$BODY = $("body"), $BODY = $("body"),
$MENU_TOGGLE = $("#menu_toggle"), $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 return Math.floor(21 * Math.random()) + 20
}; };
var setContentHeight = function () { // reset height
$RIGHT_COL.css('min-height', $(window).height()); $RIGHT_COL.css('min-height', $(window).height());
var bodyHeight = $BODY.outerHeight(), var bodyHeight = $BODY.outerHeight(),
@ -101,9 +72,20 @@ var setContentHeight = function () {
$RIGHT_COL.css('min-height', contentHeight); $RIGHT_COL.css('min-height', contentHeight);
}; };
/* SIDEBAR */
$(document).ready(function () { $(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) { $SIDEBAR_MENU.find('a').on('click', function (ev) {
var $li = $(this).parent(); var $li = $(this).parent();
@ -118,17 +100,13 @@ $(document).ready(function() {
$('.left_col.menu_fixed > .mCustomScrollBox > .mCSB_container ').css('min-height', '0'); $('.left_col.menu_fixed > .mCustomScrollBox > .mCSB_container ').css('min-height', '0');
} }
}); });
} } else {
else
{
// prevent closing menu if we are on child menu // prevent closing menu if we are on child menu
if (!$li.parent().is('.child_menu')) { if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm'); $SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp(); $SIDEBAR_MENU.find('li ul').slideUp();
}else } else {
{ if ($BODY.is(".nav-sm")) {
if ( $BODY.is( ".nav-sm" ) )
{
if (!$li.parent().is('.child_menu')) { if (!$li.parent().is('.child_menu')) {
$SIDEBAR_MENU.find('li').removeClass('active active-sm'); $SIDEBAR_MENU.find('li').removeClass('active active-sm');
$SIDEBAR_MENU.find('li ul').slideUp(); $SIDEBAR_MENU.find('li ul').slideUp();
@ -187,9 +165,11 @@ $(document).ready(function() {
$BODY.toggleClass('nav-md nav-sm'); $BODY.toggleClass('nav-md nav-sm');
setContentHeight(); $('.dataTable').each(function () {
$(this).dataTable().fnDraw();
});
$('.dataTable').each ( function () { $(this).dataTable().fnDraw(); }); setContentHeight();
}); });
// check active menu // check active menu
@ -234,7 +214,6 @@ $(document).ready(function() {
} }
}); });
/* SIDEBAR - end */ /* SIDEBAR - end */
function countChecked() { function countChecked() {
@ -924,7 +903,8 @@ function init_parsley() {
}; };
try { try {
hljs.initHighlightingOnLoad() hljs.initHighlightingOnLoad()
} catch (a) {} } catch (a) {
}
} }
} }
@ -962,6 +942,7 @@ function init_wysiwyg() {
var c = ""; 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") "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 () { "undefined" != typeof $.fn.wysiwyg && (console.log("init_wysiwyg"), $(".editor-wrapper").each(function () {
var a = $(this).attr("id"); var a = $(this).attr("id");
$(this).wysiwyg({ $(this).wysiwyg({
@ -1071,7 +1052,8 @@ function init_cropper() {
function init_knob() { function init_knob() {
if ("undefined" != typeof $.fn.knob) { if ("undefined" != typeof $.fn.knob) {
console.log("init_knob"), $(".knob").knob({ console.log("init_knob"), $(".knob").knob({
change: function(a) {}, change: function (a) {
},
release: function (a) { release: function (a) {
console.log("release : " + a) console.log("release : " + a)
}, },
@ -1420,7 +1402,8 @@ function init_EasyPieChart() {
}); });
var b = $.fn.popover.Constructor.prototype.leave; var b = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) { $.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 () { b.call(this, a), a.currentTarget && (d = $(a.currentTarget).siblings(".popover"), e = c.timeout, d.one("mouseenter", function () {
clearTimeout(e), d.one("mouseleave", function () { clearTimeout(e), d.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(c, c) $.fn.popover.Constructor.prototype.leave.call(c, c)
@ -1858,6 +1841,8 @@ function init_DataTables() {
}) })
}), TableManageButtons.init() }), TableManageButtons.init()
} }
//fix for dynamic tables
setContentHeight();
} }
function init_morris_charts() { function init_morris_charts() {
@ -4262,13 +4247,16 @@ function init_echarts() {
}) })
} }
} }
}! function(a, b) { }
!function (a, b) {
var c = function (a, b, c) { var c = function (a, b, c) {
var d; var d;
return function () { return function () {
function h() { function h() {
c || a.apply(f, g), d = null c || a.apply(f, g), d = null
} }
var f = this, var f = this,
g = arguments; g = arguments;
d ? clearTimeout(d) : c && a.apply(f, g), d = setTimeout(h, b || 100) 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; var originalLeave = $.fn.popover.Constructor.prototype.leave;
$.fn.popover.Constructor.prototype.leave = function (a) { $.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 () { originalLeave.call(this, a), a.currentTarget && (c = $(a.currentTarget).siblings(".popover"), d = b.timeout, c.one("mouseenter", function () {
clearTimeout(d), c.one("mouseleave", function () { clearTimeout(d), c.one("mouseleave", function () {
$.fn.popover.Constructor.prototype.leave.call(b, b) $.fn.popover.Constructor.prototype.leave.call(b, b)
@ -4384,4 +4373,3 @@ $.fn.popover.Constructor.prototype.leave = function(a) {
init_autosize(), init_autosize(),
init_autocomplete() init_autocomplete()
}); });

File diff suppressed because one or more lines are too long

View File

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