` 一旦我点击按钮,我就会打开gwt DialogBox。鼠标滚动只在打开的对话框上工作,我想让它也适用于父窗口。 我尝试使modal =“false”但没有用。请帮忙。
这是示例代码
<g:DialogBox autoHide="false" glassEnabled="true" modal="true" styleName="{style.historyGraphDialogPanel}">
<g:HTMLPanel >
<table class="HistoryGraphInteractionTable" ui:field="historyGraphInteractionTable">
<tbody>
<tr>
<td>
<g:Button ui:field="lastDay">Last Day</g:Button>
<g:Button ui:field="lastWeek">Last Week</g:Button>
<g:Button ui:field="lastMonth">Last Month</g:Button>
</td>
</tr>
<tr>
<td>
<cdm:HistoryGraphWidget ui:field="graphWidget" />
</td>
</tr>
<tr>
<td>
<g:Button ui:field="closeButton">Close</g:Button>
</td>
</tr>
</tbody>
</table>
</g:HTMLPanel>
.historyGraphDialogPanel {
background-color: ivory;
}`
答案 0 :(得分:0)
我不知道为什么modal
属性在ui.xml中不起作用,但在JAVA中设置模态将解决您的问题。
setModal(false);
以下是示例代码:
MyDialogbox.java:
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Widget;
public class MyDialogbox extends DialogBox {
private static MyUiBinder myUIBinder = GWT.create(MyUiBinder.class);
@UiTemplate("MyDialogbox.ui.xml")
interface MyUiBinder extends UiBinder<Widget, MyDialogbox> {
}
public MyDialogbox() {
setWidget(myUIBinder.createAndBindUi(this));
this.setModal(false);
}
@UiField
Button cancelButton;
@UiHandler("cancelButton")
void hideDialogBox(ClickEvent event) {
hide();
}
}
MyDialogbox.ui.xml:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:DialogBox autoHide="true" modal="false">
<g:caption>
<b>Caption text</b>
</g:caption>
<g:HTMLPanel>
Body text
<g:Button ui:field='cancelButton'>Cancel</g:Button>
<g:Button ui:field='okButton'>Okay</g:Button>
</g:HTMLPanel>
</g:DialogBox>
</ui:UiBinder>