cancel
Showing results for 
Search instead for 
Did you mean: 
Liliia_DevX
Sisense Team Member

Automatically Change Widget Title Based on Filter (Linux)

Introduction

Users might want to dynamically update widget titles based on active filter values for enhanced contextual relevance in dashboards. This article provides a step-by-step guide to implement this functionality using custom scripting.

Liliia_DevX_0-1745269714118.png

[ALT Text: Line graph comparing medical treatment usage over years. Treatments like bypass and chemotherapy are tracked from 2011 to 2013, showing varied trends.]

Step-by-Step Guide

  1. Navigate to the specific widget you want to modify on your Sisense dashboard.
  2. Open the widget's settings and locate the script editor.
  3. Insert the following script into the widget script editor:
widget.on("render", function () {
  let title = "name(s) selected";
  // Find the "Name" filter
  let filterUsed = dashboard.filters.$$items.find(
    (filter) => filter.jaql.title === "Name"
  );

  // Get selected Name values or set default "No" text
  let filterText =
    filterUsed && filterUsed.jaql.filter.members?.length
      ? filterUsed.jaql.filter.members.join(", ")
      : "No";
	

  let isModified = false;

  if (!isModified) {
    widget.title = filterText + ' ' + title;
    isModified = true;
  }
});

4. Adjust the column name under "Name" and any default text as necessary to fit your specific use case and data structure.

5. After adding the script, refresh the dashboard.

6. Validate that the widget title changes dynamically based on the current filter selection.

7. Ensure the column name in the script matches the actual filter setup.

8. Confirm that the script editor is appropriately saved and applied to the widget. 

Conclusion

By following the steps outlined above, you can efficiently update widget titles to reflect filter changes, improving data navigation and user engagement on your Sisense dashboards. While this feature isn't supported natively, custom scripting provides a viable workaround for dynamic title adjustments.

Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this please let us know.

Version history
Last update:
‎04-21-2025 02:12 PM
Updated by:
Contributors