cartercjb
02-21-2022ETL
DEFAULT TABBER SELECTION
I have the following tabber created:
Is there a way to dynamically set the default selection so that when the dashboard opens, it opens to the correct day? So if I were to open it today, it w...
- 02-22-2022
Hope this script works. Moved the script outside of 'render' event. Also added script to make a widget appear based on the day (update variable 'widgetid' for it)
widget.on('render',function(w, e){e.prefixText = ''; e.suffixText = ''; e.selectedColor = '#86b817'; /*The color of the chosen title*/ e.fontColor = '#cccccc'; /*The color of the unchosen titles*/ e.elementWidth = '103%'; e.descColor = '#a5a5a5'; e.parentMarginLeft = '-15px'; e.height = 32; /* affects the tabber widget default high*/ }); //your existing code widget.tabs = [ {title: "MONDAY", displayWidgetIds : [],hideWidgetIds : []}, {title: "TUESDAY", displayWidgetIds : [],hideWidgetIds : []}, {title: "WEDNESDAY", displayWidgetIds : [],hideWidgetIds : []}, {title: "THURSDAY", displayWidgetIds : [],hideWidgetIds : []}, {title: "FRIDAY", displayWidgetIds : [],hideWidgetIds : []}, //New code widgetid = '89f3b99a34c78652er3eweb' //id of widget that need to appear based on day var days = ['SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY']; var d = new Date(); var dayName = days[d.getDay()]; $.each(widget.tabs, function(index, value){ if(value.title == dayName) value.hideWidgetIds.push(widgetid) else value.displayWidgetIds.push(widgetid) }) widget.style.activeTab = widget.tabs.findIndex(el=>el.title == dayName)
-Hari