12-22-2022, 05:29 AM
(This post was last modified: 12-22-2022, 12:23 PM by rubeena.hajira.)
Script for the Freeze Header?
*Below Script to be written on the Dashboard script as it is:
sdk.freezeHeader = function (grpName) { var headerArr = $(".g_" + grpName);
// group-name which needs to be fixed
var headerArrCompOffset = {};
var dashOffset = $(".draggablesParentDiv").offset();
var maxZIndex = sdk.dashboard.m_widgetsArray.length;
for (var i = 0; i < headerArr.length; i++) { var compOffset = $(headerArr[i]).position();
/** make the hidden elements visible, get the position and hide again **/
if ($(headerArr[i])[0] && $(headerArr[i])[0].style.display == "none") { $(headerArr[i])[0].style.display = "block";
compOffset = $(headerArr[i]).position(); $(headerArr[i])[0].style.display = "none"; }
var leftPos = compOffset.left * 1 + dashOffset.left * 1;
headerArrCompOffset[headerArr[i].id] = compOffset.left * 1;
sdk.applyStyles(headerArr[i], { "position": "fixed", "left": leftPos + "px", "z-index": maxZIndex }); }
$(document).scroll( function(scroll){ var dashOffset = $(".draggablesParentDiv").offset();
for (var i = 0; i < headerArr.length; i++) { var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();
$(headerArr[i]).css('left', leftPos); }; });
$( window ).resize(function() { var dashOffset = $(".draggablesParentDiv").offset();
for (var i = 0; i < headerArr.length; i++) { var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();
$(headerArr[i]).css('left', leftPos); }; });
};
*This Script should be written in the script of the First loading connection in the Dashboard.
*Should create a group of components that should be frozen and then that group name should be added in a script as written below(group name:fc):
sdk.freezeHeader('fc');
*Below Script to be written on the Dashboard script as it is:
sdk.freezeHeader = function (grpName) { var headerArr = $(".g_" + grpName);
// group-name which needs to be fixed
var headerArrCompOffset = {};
var dashOffset = $(".draggablesParentDiv").offset();
var maxZIndex = sdk.dashboard.m_widgetsArray.length;
for (var i = 0; i < headerArr.length; i++) { var compOffset = $(headerArr[i]).position();
/** make the hidden elements visible, get the position and hide again **/
if ($(headerArr[i])[0] && $(headerArr[i])[0].style.display == "none") { $(headerArr[i])[0].style.display = "block";
compOffset = $(headerArr[i]).position(); $(headerArr[i])[0].style.display = "none"; }
var leftPos = compOffset.left * 1 + dashOffset.left * 1;
headerArrCompOffset[headerArr[i].id] = compOffset.left * 1;
sdk.applyStyles(headerArr[i], { "position": "fixed", "left": leftPos + "px", "z-index": maxZIndex }); }
$(document).scroll( function(scroll){ var dashOffset = $(".draggablesParentDiv").offset();
for (var i = 0; i < headerArr.length; i++) { var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();
$(headerArr[i]).css('left', leftPos); }; });
$( window ).resize(function() { var dashOffset = $(".draggablesParentDiv").offset();
for (var i = 0; i < headerArr.length; i++) { var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();
$(headerArr[i]).css('left', leftPos); }; });
};
*This Script should be written in the script of the First loading connection in the Dashboard.
*Should create a group of components that should be frozen and then that group name should be added in a script as written below(group name:fc):
sdk.freezeHeader('fc');