I have made a panel plugin with React for Grafana 7. I would like to know when the panel is resized in the dashboard (i.e. dragged with mouse to make larger or smaller), so the plugin can react to this. I have searched for some kind of onResize event or similar but can't find anything. Is there a way to detect when a panel is resized?
问问题
120 次
1 回答
0
这是我在面板插件中处理调整大小的方法:
const panelContainer = document.querySelector('selector_for_element_inside_your_plugin').closest('.panel-wrapper');
const panelContanerResizeObserver = new ResizeObserver(resizeHandler);
panelContanerResizeObserver.observe(panelContainer);
简而言之,您选择面板包装器并使用ResizeObserver处理其调整大小
于 2021-05-15T12:32:49.717 回答