i am building a dashboard with gridster and highcharts. If i resize the window and a widget with a highchart is bigger than the window, i want to resize it to make it smaller and gridster should recalculate the positions of the others. I tried this code to make a widget and its highchart smaller if its bigger than the windows width:
$( ".dashboard > li" ).each(function()
{
var chart = $(this).children('div');
// console.log(' Window: ' + width);
console.log(chart);
if(chart.width() > width)
{
//alert('hier');
// $(this).css('width',width + 'px');
$(this).css('background-color','red');
chart.width(width);
chart.highcharts().reflow();
}
});
but nothing happens.
If i resize the widgets and its highcharts manually, the main grid is still bigger than the window, because it doesnt recalcualte.
Please help me with that.
Update1: Positioning-Problem
So now i've made it in this way: If the screensize is unter a limit, all widgets get the same size and will be pushed to the first row by setting data-col=1 with jquery. Now a new problem occurs: The pushed widgets are overlapping the others. I guess gridster isnt recalcualting this stuff. How do i force him to recalcualte positions? "avoid_overlapped_widgets: true" isn't working