cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

This Script Is Created To Center The Pivot Table Inside The Dashboard Widget.

Instead of Pivot Table being anchored to the top left,  you can use this script to make the pivot centered both vertically and horizontally.
Please note, this working only for "Pivot Table widget" with version 1.

STEP-BY-STEP GUIDE:

  1. Open a pivot widget in Sisense dashboard and go to 'Edit Script'
  2. Copypaste the below script and press save button
  3. Test the results, see how a Pivot table is centered in your screen
  4. Feel free to modify values in the script "margin-left" and "margin-top" to make the Pivot in the right position
Script:
widget.on('ready', function(widget) {
var widgetContainer = $('[widgetid="'+ widget.oid + '"]')
if (prism.$ngscope.appstate === "dashboard") {
$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('p-container')).css('margin-left', '25%') .css('margin-top', '10%')
} else if (prism.$ngscope.appstate === "widget") {
$(document.getElementsByClassName('p-container')).css('margin-left', '25%').css('margin-top', '10%')
}
})

widget.on('domready', function(widget) {
var widgetContainer = $('[widgetid="'+ widget.oid + '"]')
if (prism.$ngscope.appstate === "dashboard") {
$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('phantom')).remove()
} else if (prism.$ngscope.appstate === "widget") {
$(document.getElementsByClassName('phantom')).remove()
}
})

THIS IS HOW IT LOOKS LIKE:

Rate this article:
Comments
MarkZither
7 - Data Storage
7 - Data Storage

If you are looking for this for Pivot Table 2 change the lines with getElementsByClassName('p-container') such as

$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('p-container')).css('margin-left', '25%') .css('margin-top', '10%')

to use pivot-container

$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('pivot-container')).css('margin-left', '25%') .css('margin-top', '10%')

 

SiftHealthcare
8 - Cloud Apps
8 - Cloud Apps

@MarkZither Do you know if this is still working? I am unable to get this script to work. 

Liliia_DevX
Sisense Team Member
Sisense Team Member

@SiftHealthcare hi!

Please note that this script was designed for Pivot running on Windows based version. I've checked it form our side and it seems to be working:

Liliia_DevX_0-1725445625622.png

For the Sisense application running on Linux, please try to use a script below:

widget.on('ready', function(widget) {
var widgetContainer = $('[widgetid="'+ widget.oid + '"]')
if (prism.$ngscope.appstate === "dashboard") {
$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('pivot-container')).css('margin-left', '25%') .css('margin-top', '10%')
} else if (prism.$ngscope.appstate === "widget") {
$(document.getElementsByClassName('p-container')).css('margin-left', '25%').css('margin-top', '10%')
}
})

widget.on('domready', function(widget) {
var widgetContainer = $('[widgetid="'+ widget.oid + '"]')
if (prism.$ngscope.appstate === "dashboard") {
$('[widgetid="'+ widget.oid + '"]').find(document.getElementsByClassName('phantom')).remove()
} else if (prism.$ngscope.appstate === "widget") {
$(document.getElementsByClassName('phantom')).remove()
}
})

Liliia_DevX_1-1725445837888.png

Hope that helps to achieve your goal!

Version history
Last update:
‎03-02-2023 09:05 AM
Updated by:
Contributors