0
我有一個簡單的模式,我想單擊按鈕時顯示。GWT-Bootstrap Modal未在setVisible之後顯示
下面是我用來顯示模態
@UiHandler("submit")
void handleClick(ClickEvent e){
ModalDialogDemo modalDialog = (ModalDialogDemo) RootPanel.get().getWidget(2);
modalDialog.setHeight("200px");
modalDialog.setWidth("100px");
modalDialog.setVisible(true);
if(modalDialog.isVisible()){
System.out.println("Successfully Displayed the Modal!");
}
else{
System.out.println("Something went wrong.");
}
}
即使模態不顯示在屏幕上登錄到控制檯的消息是前者,即成功顯示了模態代碼!
我做了一些與螢火蟲和之前的按鈕挖單擊呈現的HTML是
<div>
<div class="modal" style="display: none;" aria-hidden="true">
<div class="modal-header"><a class="close" data-dismiss="modal">×</a><h3>Name</h3></div>
<div class="modal-body"><div class="gwt-Label">Modal Content Comes Here</div></div>
<div class="modal-footer"><div class="gwt-Label">And this is the footer</div></div></div>
</div>
按鈕被點擊之後,它改變
<div style="height: 200px; width: 100px;" aria-hidden="false">
<div class="modal" style="display: none;" aria-hidden="true">
<div class="modal-header"><a class="close" data-dismiss="modal">×</a><h3>Name</h3></div>
<div class="modal-body"><div class="gwt-Label">Modal Content Comes Here</div></div>
<div class="modal-footer"><div class="gwt-Label">And this is the footer</div></div></div>
</div>
第一個div有高度和寬度我設置了應用並隱藏了詠歎調也被清除,但實際上包含模式的子div不受影響。
我不知道如何告訴GWT將更改應用到子div,有人可以幫我解決這個問題嗎?
編輯: 這是我ModalDialogDemo.ui.xml
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b = "urn:import:com.github.gwtbootstrap.client.ui">
<g:HTMLPanel>
<b:Modal title="VipName" backdrop="STATIC">
<g:Label>Modal Content Comes Here</g:Label>
<b:ModalFooter>
<g:Label>And this is the footer</g:Label>
</b:ModalFooter>
</b:Modal>
</g:HTMLPanel>
</ui:UiBinder>
然後調用,
modalDialog.getVipNameModel().show();
有沒有'的模式show'方法:創建getter方法。 http://gwtbootstrap.github.com/gwt-bootstrap/apidocs/com/github/gwtbootstrap/client/ui/Modal.html – nikhil 2013-02-26 09:44:53
@nikhil請看你提到的API文檔。 'public void show():顯示小部件是否曾經隱藏過.'嘗試使用它。我用它來顯示使用gwt-bootstrap-2.2.1.0-SNAPSHOT.jar的模態。你使用哪個版本? – iMBMT 2013-02-26 10:46:31
我認爲你是對的@takrbuiam我也添加了我的UIBinder代碼。我如何從ModalDialogDemo類中選擇Modal?如果我能夠選擇那個,那麼我就可以調用'show'。任何指針呢? – nikhil 2013-02-26 10:58:59