How?? to handle Mouse Scroll

Hi,

In my application, I am using Grid to load data and also using ContextWindowMenu to pop up a window when user right clicks on the grid. I am setting close and Modal features to false as per my requirements and the window will close when the user clicks at any place on UI apart from ContextMenuWindow. But, here the problem is the window is open/visible when user scroll the grid in background. Here, I want to handle the mouse scroll, such that when ever the user scroll the grid, I need to close the opened ContextMenuWindow. So, I need to know how to handle the mouse scroll in Vadin 8 Framework.

Thanks,

Serafin

Hi.

I guess the easiest way is to make an extension to grid that informs you of scroll events.
There is the add-on by Tatu https://vaadin.com/directory/component/gridscrollextension-add-on/
that brings a scroll listener.

GridScrollExtension ext1 = new GridScrollExtension(grid1);

ext1.addGridScrolledListener(event -> {
    Integer yPos = ext1.getLastYPosition();
	field.setValue(yPos.toString());
});
  • Mikael

Hi Mikael,

Thank you so much for your response. It resolved my problem. But I have an other question, is there any other extension for Tree foe the same issue?