Updating widget titles
AnsweredI am using a widget script to update my widget title. I am pulling the title from a dashboard filter - I need to add a date to the title.
The problem is that I am updating the title with a new string every time the dashboard filter is changed. The title string in the widget class is changing but the dashboard is not refreshing the title...
the code looks something like this:
widget.on('ready', function(d, a){
.....
.....
prism.activeWidget.title = newTitle;
prism.activeWidget.redraw();
});
I have tried to use different events but it just doesn't seem to work. ~~
-
Hi Aditaya,
I don't have a code snippet out-of-the-box for you but the genreal approach should be something like:
1) Move your logic to the Dashboards level (I.E. the dahsboard script instead of the widget script(
2) Write some code that will run on every "filterschanged" event (in some Sisense versions there are bugs with that events so if needed, I have a workaround for that as well but its a fairly dirty patch so I would recommend avoiding it if the filterschanged event is working properly for your version
3) Get from the dashboard object a list of all its widgets and update their title according to your desired logic with the selected filters/dates
4) Init the titles for hte first time upon the "dashboardloaded" loaded event as if I'm n ot mistaken, the "filterschanged" event is called only upon filters changes of the user.
Let me know if you need any further help, we're always happy to help (:
Ravid
Paldi Solutuions, an official implementation partner of Sisense
Please sign in to leave a comment.
Comments
6 comments