cancel
Showing results for 
Search instead for 
Did you mean: 

REFERENCING WIDGETID AS VARIABLE IN TABBER

cartercjb
10 - ETL
10 - ETL

Can anyone recommend the best-practice approach for defining each widget ID as its own variable so that I can reference the names in this script instead? I'm having a difficult time keeping each tab accurately updated.  

cartercjb_0-1647369623530.png

This is what I have currently configured as a Tabber action:

cartercjb_0-1647438460281.png

 const value = payload.title;

// This is the css selector for each widget
// widget[widgetid="{your widget id}"]
//const _id = 'widget[widgetid=]'
const H1_id = 'widget[widgetid="620347e5b8defd34f012d25e"]'
const H2_id = 'widget[widgetid="621e7b388133b3087c4fc496"]'
const TPMHRS_id = 'widget[widgetid="621ec6558133b3087c4fc4c3"]'
const CPT_id = 'widget[widgetid="621e60febe4b2e2fc8936f18"]'

const GRCO_id = 'widget[widgetid="621e79a18133b3087c4fc457"]'
const DISCSP_id = 'widget[widgetid="61fc1ef0b8defd34f012bae8"]'
const PTTXDATES_id = 'widget[widgetid="620368da902bfa28e00694bb"]'
const SITEFILTER_id = 'widget[widgetid="621ef3418133b3087c4fc565"]'
const PDPMSTAYS_id = 'widget[widgetid="621ef4128133b3087c4fc56b"]'
const SNFMEDB_id = 'widget[widgetid="621ff2adbe4b2e2fc89373fc"]'
const TXFX_id = 'widget[widgetid="621f2cfe8133b3087c4fc66a"]'
const TXFXPT_id = 'widget[widgetid="621f34298133b3087c4fc69e"]'
const Pivot_id = 'widget[widgetid="621f30998133b3087c4fc685"]'
const TitleNSK_id = 'widget[widgetid="621fe60ebe4b2e2fc89373a6"]'

if (value == 'HOME') {
    $(H1_id).show()
    $(H2_id).show()
    $(TPMHRS_id).show()
    $(CPT_id).hide()
    $(GRCO_id).hide()
    $(DISCSP_id).hide()
    $(PTTXDATES_id).hide()
    $(SITEFILTER_id).hide()
    $(PDPMSTAYS_id).hide()
    $(SNFMEDB_id).hide()
    $(TXFX_id).hide()
    $(TXFXPT_id).hide()
    $(Pivot_id).hide()
    $(TitleNSK_id).hide()
    

} else if (value == 'Category') {
    $(H1_id).hide()
    $(H2_id).hide()
    $(TPMHRS_id).hide() 
    $(CPT_id).show()
    $(GRCO_id).show()
    $(DISCSP_id).show()
    $(PTTXDATES_id).show()
    $(SITEFILTER_id).show()
    $(PDPMSTAYS_id).show()
    $(SNFMEDB_id).show()
    $(TXFX_id).show()
    $(TXFXPT_id).show()
    $(Pivot_id).show()  
    $(TitleNSK_id).show()
} else {
    $(H1_id).hide()
    $(H2_id).hide()
    $(TPMHRS_id).hide()
    $(CPT_id).hide()
    $(GRCO_id).hide()
    $(DISCSP_id).hide()
    $(PTTXDATES_id).hide()
    $(SITEFILTER_id).hide()
    $(PDPMSTAYS_id).hide()
    $(SNFMEDB_id).hide()
    $(TXFX_id).hide()
    $(TXFXPT_id).hide()
    $(Pivot_id).hide()
    $(TitleNSK_id).hide()
}

I also have this dashboard script which is supposed to correctly load as if the HOME  button was selected by default:

/*
Welcome to your Dashboard's Script.

To learn how you can access the Widget and Dashboard objects, see the online documentation at https://developer.sisense.com/pages/viewpage.action?pageId=557127
*/ 




dashboard.on('domready',function(d) {
	
	const H1_id = 'widget[widgetid="620347e5b8defd34f012d25e"]'
	const H2_id = 'widget[widgetid="621e7b388133b3087c4fc496"]'
	const TPMHRS_id = 'widget[widgetid="621ec6558133b3087c4fc4c3"]'
	const CPT_id = 'widget[widgetid="621e60febe4b2e2fc8936f18"]'

	const GRCO_id = 'widget[widgetid="621e79a18133b3087c4fc457"]'
	const DISCSP_id = 'widget[widgetid="61fc1ef0b8defd34f012bae8"]'
	const PTTXDATES_id = 'widget[widgetid="620368da902bfa28e00694bb"]'
	const SITEFILTER_id = 'widget[widgetid="621ef3418133b3087c4fc565"]'
	const PDPMSTAYS_id = 'widget[widgetid="621ef4128133b3087c4fc56b"]'
	const SNFMEDB_id = 'widget[widgetid="621ff2adbe4b2e2fc89373fc"]'
	const TXFX_id = 'widget[widgetid="621f2cfe8133b3087c4fc66a"]'
	const TXFXPT_id = 'widget[widgetid="621f34298133b3087c4fc69e"]'
	const Pivot_id = 'widget[widgetid="621f30998133b3087c4fc685"]'
	const TitleNSK_id = 'widget[widgetid="621fe60ebe4b2e2fc89373a6"]'


	$(H1_id).show()
    $(H2_id).show()
    $(TPMHRS_id).show()
    $(CPT_id).hide()
    $(GRCO_id).hide()
    $(DISCSP_id).hide()
    $(PTTXDATES_id).hide()
    $(SITEFILTER_id).hide()
    $(PDPMSTAYS_id).hide()
    $(SNFMEDB_id).hide()
    $(TXFX_id).hide()
    $(TXFXPT_id).hide()
    $(Pivot_id).hide()
	$(TitleNSK_id).hide()
}) 

However, when the dashboard loads it does not load correctly. It slowly removes the hidden widgets. See here for an example:

cartercjb_1-1647438639783.gif

 Any suggestions on how to correctly load the dashboard as if the first button is selected?

Thanks!

 

0 REPLIES 0