0

我有一个<h:dataTable>将输入文本的内容添加到嵌套列表中的<h:dataTable>. 隐藏的命令按钮链接到输入文本问题只是第一个输入文本的操作方法起作用,因此只有附加到父消息的第一个线程的列表不会连续更新一次。

    <p:tabView id="tabView">
        <p:tab id="tab1" title="Conversation">
            <h:form id="pol">
                <p:dataTable var="message"
                    value="#{channelBean.getBean('channel').messageList}"
                    id="messageListTable">
                    <p:column>
                        <f:facet name="header">Photo</f:facet>
                        <h:outputText value="Photo" />
                    </p:column>
                    <p:column>
                        <f:facet name="header">Message</f:facet>
                        <p:panelGrid columns="1">
                            <p:panelGrid columns="3">
                                <h:outputText value="#{message.sender}" />
                                <h:outputText rendered="#{message.channel!=null}"
                                    value="#{message.channel.name}" />
                                <h:outputText value="#{message.message}" escape="false" />
                            </p:panelGrid>
                            <p:panelGrid columns="8">
                                <h:outputText value="#{message.postedString}" />
                                <h:form>
                                    <p:commandLink id="likeLink" value="UnLike"
                                        rendered="#{message.liked}" update="@parent" ajax="false">
                                        <f:actionListener binding="#{channelBean.like(message)}" />
                                    </p:commandLink>
                                    <p:commandLink id="unLikeLink" value="Like"
                                        rendered="#{!message.liked}" update="@parent" ajax="false">
                                        <f:actionListener binding="#{channelBean.unLike(message)}" />
                                    </p:commandLink>
                                    <h:outputText value="." />
                                    <h:outputText value="Reply" />
                                    <h:outputText value="." />
                                    <h:outputText value="Share" />
                                    <h:outputText value="." />
                                    <p:commandLink id="moreLink" value="More" />
                                    <p:menu overlay="true" trigger="moreLink" my="left top"
                                        at="left bottom">
                                        <p:menuitem value="Save" icon="ui-icon-disk" />
                                        <p:menuitem value="Update" icon="ui-icon-arrowrefresh-1-w" />
                                    </p:menu>
                                </h:form>
                            </p:panelGrid>
                        </p:panelGrid>
                    </p:column>
                </p:dataTable>
            </h:form>
        </p:tab>
        <p:tab id="tab2" title="Info">
            <h:form id="channelViewForm">
                <l:inputTextarea
                    cid="com_fourforbusiness_esm_shared_domain_ffbesm_Channel_description"
                    label="#{msg.description}:"
                    value="#{channelBean.getBean('channel').description}" />
                <p:commandLink value="#{msg.save}"
                    update=":sideBarForm:subscribedChannels,@parent">
                    <f:actionListener
                        binding="#{channelBean.saveChannel('channel')}" />
                </p:commandLink>
            </h:form>
        </p:tab>
        <p:tab id="tab3" title="File"></p:tab>
        <p:tab id="tab4" title="Notes"></p:tab>
    </p:tabView>
</p:panel>

<p:panel id="inbox" visible="#{mainViewBean.currentView=='IN_BOX'}"
    autoUpdate="true">
    <h:form id="pol">
        <p:dataTable var="message"
            value="#{channelBean.subscribedChannelsMessages}"
            id="messageListTable"

            >
            <p:column>
                <f:facet name="header">Photo</f:facet>
                <h:outputText value="Photo" />
            </p:column>
            <p:column>
                <f:facet name="header">Message</f:facet>
                <p:panelGrid columns="1">
                    <p:panelGrid columns="3">
                        <h:outputText value="#{message.sender}" />
                        <h:outputText rendered="#{message.channel!=null}"
                            value="#{message.channel.name}" />
                        <h:outputText value="#{message.message}" escape="false" />
                    </p:panelGrid>
                    <p:panelGrid columns="8" id="panelx">
                        <h:outputText value="#{message.postedString}" />
                        <h:form>
                            <p:commandLink id="likeLink" value="UnLike"
                                rendered="#{message.liked}" update="@parent" ajax="false">
                                <f:actionListener binding="#{channelBean.like(message)}" />
                            </p:commandLink>
                            <p:commandLink id="unLikeLink" value="Like"
                                rendered="#{!message.liked}" update="@parent" ajax="false">
                                <f:actionListener binding="#{channelBean.unLike(message)}" />
                            </p:commandLink>
                            <h:outputText value="." />
                            <p:commandLink id="replyLink" value="Reply" action="#{channelBean.enabletextbox}" process="@this" ajax="true" update=":pol">

                            </p:commandLink>

                            <h:outputText value="." />
                            <h:outputText value="Share" />
                            <h:outputText value="." />
                            <p:commandLink id="moreLink" value="More" />
                            <p:menu overlay="true" trigger="moreLink" my="left top"
                                at="left bottom">
                                <p:menuitem value="Save" icon="ui-icon-disk" />
                                <p:menuitem value="Update" icon="ui-icon-arrowrefresh-1-w" />
                            </p:menu>
                            <BR></BR>
                            <p:inputText value="#{channelBean.repli}" rendered="#{channelBean.replyClicked}" id="replyTxt"  ></p:inputText>
                            <p:commandButton value="repSave" ajax="true" actionListener="#{channelBean.addMessage(message)}" rendered="#{channelBean.replyClicked}" update=":pol" style="visibility: hidden;" oncomplete="alert('#{message.message}');"> </p:commandButton>


                            <p:dataTable var="rep" id="replyListTable" value="#{message.replyList}">  
                                <p:column headerText="Replies">  
                                    <h:outputText value="#{rep.reply}" />  
                                </p:column>  
                          </p:dataTable>  
                        </h:form>
                    </p:panelGrid>
                </p:panelGrid>
            </p:column>
        </p:dataTable>
    </h:form>
</p:panel>

支持豆:

public void addMessage (Message msg)
{

    List<Message> subList=this.getSubscribedChannelsMessages();
    for(Message mess:subList)
    {
        if(mess.getMessage().equalsIgnoreCase(msg.getMessage()))
        {
            msg.getReplyList().add(new Reply (repli));
            repli = "";
            replyClicked = false;
        }
    }


}

public void enabletextbox()
{
    if (replyClicked==false)
        replyClicked =true;
    else 
        replyClicked = false;
}

我不明白为什么<p:commandButton>嵌套的<h:dataTable>不调用它的actionListener。这是如何引起的,我该如何解决?

4

0 回答 0