cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing widgets past their size limits

lharrison
8 - Cloud Apps
8 - Cloud Apps

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. 

lharrison_0-1639578794890.png

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?

1 ACCEPTED SOLUTION

harikm007
9 - Travel Pro
9 - Travel Pro

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

View solution in original post

1 REPLY 1

harikm007
9 - Travel Pro
9 - Travel Pro

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

View solution in original post