Forum Discussion

lharrison's avatar
lharrison
Cloud Apps
12-15-2021
Solved

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 mi...
  • harikm007's avatar
    12-16-2021

    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