Setting Maximum Panel Items on Widget Panels via Scripting
Summary: Jeremy Friedel discusses an issue with setting maximum items on Widget Panels in Sisense using scripts. A commonly used script that modifies the maxitems property may not work on some versions (L2026.2.2-c). For users experiencing issues, a replacement script is provided, which waits for an initialization event before accessing panel data, using a different path that is more reliable. A plugin, PivotMaxPanelItems, is suggested for those requiring automatic application across multiple widgets or user groups. The discussion advises updates if the older method fails, but if it's functional, no changes are necessary.
Setting Maximum Items on Widget Panels via Script
Sisense widgets set max panel item per type (values, rows, etc) limits that control how many dimensions, measures, and filters can be added to each panel. When these limits are reached, the Add Panel button is hidden, preventing users from adding additional fields. A widget script that sets the maxitems property on each panel is commonly used to raise (or occasionally lower) this limit. This very commonly used script may be experiencing issues on some new releases of Sisense (L2026.2.2-c).
Dashboard designers and developers who have this script in place and are not experiencing any issues may leave the script unchanged. Dashboard designers who are experiencing problems can replace the script with the version shared below.
For use cases that specifically use this script for pivot widgets and want it applied automatically across many widgets or configured per user group, the PivotMaxPanelItems plugin is a more scalable alternative. See Extending Pivot Widget Panel Limits in Sisense Using User Groups for details.
Script That May Not Work
The following script is commonly used as a widget script to raise the panel item limit:
This script accesses the panel metadata maxitems parameter directly through widget.manifest.data.panels. Based on current behavior, this path appears to be broken in some environments on specific Sisense versions.
Without the script applied, if a panel type includes too many items, the Add Panel Button is hidden.
Replacement Script
The following script produces the same result and can be more reliable.
widget.on('initialized', function() {
widget.metadata.panels.forEach(function(p) {
p.$$manifest.metadata.maxitems = 60; // replace with the value needed
});
});
This version waits for the initialized event before accessing panel data, and references the panel's $$manifest.metadata path rather than going through widget.manifest.data.
Dashboard designers and developers should update the maxitems value to match the limit needed for their use case. Note that setting a very high limit and adding a large number of fields to a widget may result in extended load times.
With the script applied, the Add Panel Button does not disappear when below the new limit, and as many dimensions and fields as needed can be added to the widget.
Applying This to More Complex Scripts and Plugins
This potential fix applies to any plugin or script that sets maxitems on widget panels and uses this exact path. If a plugin or script accesses panel metadata through widget.manifest.data.panels and is functioning correctly, no changes are necessary. If it appears to no longer work, updating it to use widget.metadata.panels and reference p.$$manifest.metadata is likely to fix the issue.
The scripts above are simply examples. More dynamic implementations, such as those that read current values, apply conditional logic, or use different values based on user type or user group, follow the same principle, if the older method is not working, replacing the maxitems path is a likely fix.