lharrison
12-15-2021Cloud Apps
Resizing widgets past their size limits
Hello. When using tables with aggregation, I often want to display a single row of data. The widget won't let me reduce the height enough to get rid of all the white space (see below). This is the minimum height of the widget.
I would like to be able to make the widget exactly as tall as it needs to be to show that single line table. Is there a way I can do this through scripts?
Hi lharrison ,
Try this dashboard script. Here height is hardcoding, not dynamically adjust based on number of rows in table. (assign your widget ID and required height in the variables)
dashboard.on('refreshstart', function (se, ev) { widgetid = '615ee0063312d60030f8060c' widget_height = 100 $.each(ev.dashboard.layout.columns, function(columnIndex, column){ $.each(column.cells, function(cellIndex, cell){ $.each(cell.subcells, function(subcellIndex, subcell){ if(subcell.elements[0].widgetid == widgetid) { subcell.elements[0].height = widget_height + 'px' subcell.elements[0].minHeight = widget_height subcell.elements[0].maxHeight = widget_height } }) }) }) ev.dashboard.layout.defaults.widget.minHeight = 0 ev.dashboard.layout.defaults.widget.maxHeight = widget_height });
Thanks.
Hari