[英]Avoid GWT DataGrid Rows Scrolling
In a GWT DataGrid
I wan to to avoid / prevent the table data rows scrolling in case of some peculiar application status. 在
GWT DataGrid
我希望避免/防止表数据行在某些特殊应用程序状态下滚动。
I already tried to catch ScrollEvent
, but I think that such event was fired “after” rows scrolling has been done. 我已经尝试捕获
ScrollEvent
,但是我认为此类事件是在“行”滚动完成之后触发的。
I also tried to “hide” every “tool” that a user can manage in order to get rows scrolling; 我还尝试“隐藏”用户可以管理的每个“工具”,以使行滚动。 so I tried:
所以我尝试了:
.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
and 和
scrollPanel.removeVerticalScrollbar();
but Mouse Wheel Actions still keep fire rows scrolling ... therefore maybe should be enough to avoid mouse wheel scrolling actions to reach my goal ? 但是鼠标滚轮动作仍然可以使火行滚动……因此,应该足以避免鼠标滚轮滚动动作达到我的目标吗?
Please note that I don't want to remove Horizontal Scrolling. 请注意,我不想删除水平滚动。
Any suggestions will be appreciated. 任何建议将不胜感激。
Thanks in advance 提前致谢
Here are two solutions. 这是两个解决方案。 try any one
尝试任何一个
DOM.sinkEvents(getDocElement(), Event.ONMOUSEWHEEL);
Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(final NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONMOUSEWHEEL) {
event.getNativeEvent().preventDefault();
}
}
});
dataGrid.sinkEvents(Event.ONMOUSEWHEEL);
Not a good solution but still you can try this one also. 这不是一个很好的解决方案,但您仍然可以尝试此解决方案。
dataGrid.addCellPreviewHandler(new Handler<Contact>() {
@Override
public void onCellPreview(CellPreviewEvent<Contact> event) {
dataGrid.getRowElement(0).scrollIntoView();
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.