For any support or more customized script, contact us -  binextlevel@gmail.com

Align Pivot 2 to center of Sisense widget container

Below dashboard script will align Pivot2 to center of widget container






dashboard.on('widgetready', function (se, args) {
	
	//widgetid of pivot
	widgetid = '85c345hj7845560080c9g148'
	
	if(args.widget.oid == widgetid)
	{
		var pivotWidth = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container .multi-grid .pivot-scroller .table-grid .table-grid__table', element).width())
		var pivotHeight = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container .multi-grid .pivot-scroller .table-grid .table-grid__table', element).height())
        var containerWidth = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).width())
		var containerHeight = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).height())
		
		if(pivotWidth < containerWidth)
        	$('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).css('margin-left', 'calc(50% - ' + (pivotWidth/2) + 'px)')
			
		if(pivotHeight < containerHeight)
       		$('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).css('margin-top', ((containerHeight/2) - (pivotHeight/2)) + 'px')
	}
});

65 views0 comments

Recent Posts

See All