0

我动态创建我的面板,我想用对话框编辑它们。我可以更新数据库一切正常,但视图没有更新:这是我的对话框,带有命令按钮“submitDialog”:

        <p:dialog id="dialog" header="Add Memo" widgetVar="dialogMemo" resizable="false" >
        <h:form id="formDialog">
            <h:panelGrid columns="2" cellpadding="5">  
                <h:outputLabel for="commentInput" value="Comment:" />  
                <p:inputTextarea id="commentInput" value="#{dashboardBean.currentComment}" rows="6" cols="25" label="commentInput" required="true"/>
                <p:watermark for="commentInput" value="Enter your memo..."/>  
                <h:outputLabel for="selectShare" value="Share Memo: " />  
                <p:selectBooleanCheckbox id="selectShare" /> 

                <h:outputLabel for="choosePriority" value="Priority:" />  
                <p:selectOneMenu id="choosePriority" value="#{dashboardBean.currentPriority}" label="choosePriority">  
                    <f:selectItem itemLabel="Low Priority" itemValue="1" />  
                    <f:selectItem itemLabel="Medium Priority" itemValue="2" />  
                    <f:selectItem itemLabel="High Priority" itemValue="3" />  
                </p:selectOneMenu>

                <p:commandButton id="submitDialog" icon="ui-icon-check" value="Confirm" ajax='false' type="submit"/>
                <p:commandButton icon="ui-icon-close" onclick="dialogMemo.hide();" value="Cancel"/>
            </h:panelGrid>
        </h:form>
    </p:dialog>

我的面板被添加到“dashboardId”:

    <p:layout fullPage="true">
        <p:layoutUnit id="leftPanel" position="west" size="250" header="My Memos" resizable="false" closable="false" collapsible="false">
            <h:form id="form"> 
                <p:commandButton id="addMemo" icon="ui-icon-plus" onclick="dialogMemo.show();" type="submit" action="#{dashboardBean.getEditControl}"/>  
                <p:dashboard id="dashboardId" model="#{dashboardBean.model}" binding="#{dashboardBean.dashboard}">
                </p:dashboard>  
            </h:form>
        </p:layoutUnit>
    </p:layout>

我尝试解决这个问题,当我打开对话框时,我将更新属性设置为带有面板 ID 的命令按钮“submitDialog”:

public void handleEdit(ActionEvent actionEvent)
{
    UIComponent component = actionEvent.getComponent().getParent().getParent();
    String id = component.getId();

    UIViewRoot view = FacesContext.getCurrentInstance().getViewRoot();
    CommandButton button = (CommandButton) view.findComponent("formDialog:submitDialog");
    button.setUpdate(":form:" + id);
}

数据库已正确修改,页面已重新加载,但我的面板未更新。

4

1 回答 1

0

我通过直接编辑面板的 HtmlOutputText 解决了我的问题。

于 2013-09-11T13:57:07.560 回答