Vaadin Grid:如何禁用运行内联编辑器的鼠标事件处理程序?
Vaadin Grid : How to disable mouse event handler which runs inline editor?
我正在使用 Grid 和打开的编辑器 (setEditorEnabled(true)),但我将通过调用 editItem() 方法以编程方式启动内联编辑器。如何禁用运行内联编辑器的鼠标事件处理程序?
感谢@Morfic,我解决问题如下:
Grid grid = new Grid(){
@Override
protected void doCancelEditor() {
super.doCancelEditor();
setEditorEnabled(false); // disable the editor every time when editing is completed
}
};
grid.setEditorEnabled(false); // by default the editor is disabled
....
// grid initialization
....
// create any component (button for example) which will call the editor
Button button = new Button("Edit");
button.addClickListener((Button.ClickListener) event -> {
grid.setEditorEnabled(true); // activate the editor when the desired event occurred
grid.editItem(itemId); // call the editor with itemId (it may be selected itemId)
});
我正在使用 Grid 和打开的编辑器 (setEditorEnabled(true)),但我将通过调用 editItem() 方法以编程方式启动内联编辑器。如何禁用运行内联编辑器的鼠标事件处理程序?
感谢@Morfic,我解决问题如下:
Grid grid = new Grid(){
@Override
protected void doCancelEditor() {
super.doCancelEditor();
setEditorEnabled(false); // disable the editor every time when editing is completed
}
};
grid.setEditorEnabled(false); // by default the editor is disabled
....
// grid initialization
....
// create any component (button for example) which will call the editor
Button button = new Button("Edit");
button.addClickListener((Button.ClickListener) event -> {
grid.setEditorEnabled(true); // activate the editor when the desired event occurred
grid.editItem(itemId); // call the editor with itemId (it may be selected itemId)
});