Hello, I am actually adding a dashboard in my application and am using th

Hello,

I am actually adding a dashboard in my application and am using this great chart add-on. I also need to add drag and drop feature to the dashboard and am using the add-on from Jean-Christophe Gueriaud (sortable-layout - Vaadin Add-on Directory). But when I drag and drop the component, it becomes invisible but the component is still there.

//Use vertical layout to contain the SOChart object
SOChart soChart = buildChart();
VerticalLayout chartLayout = new VerticalLayout();
chartLayout.add(soChart);

//to use the drag and drop add-on
VerticalLayout dashletLayout = new VerticalLayout();
dashletLayout.add(chartLayout);
SortableLayout sortableLayout = new SortableLayout(dashletLayout);

verticalLyoutContainer.add(sortableLayout);

When I run, the chart is displayed. But it disappears after I drag and drop. Other dashlet containing a list object can be dragged and dropped correctly. Can anyone please tell me what is wrong?

I got it working.

Need to refresh the SOChart component after the drag and drop.

// add listener to the layout
sortableLayout.addSortableComponentReorderListener(component -> {
	dashlet.getSoChart().update();
});

It’s better to use update(true); rather than using update(); if you are using any version < 2.2.0. The update(); call will unnecessarily send the full data set again to the client. Since, you know that the data is not changed, you can use update(true);. The parameter says - skip the data.

However, starting from version 2.2.0, the default is to skip data (also, it will automatically determine if any new data set is added and transmit it).