Richfaces: show details in popup [commandbutton, action and popupPanel]

后端 未结 1 1296
太阳男子
太阳男子 2020-12-12 03:50

I have a xhtml like this:



        
相关标签:
1条回答
  • 2020-12-12 04:14

    Store server identifier (name or id) in bean (see my answer) and reuse it in popup.

    Example:

        <h:form id="notesForm">
            <rich:messages />
    
            <a4j:jsFunction name="selectRow" oncomplete="#{rich:component('noteDetails')}.show()"
                render="noteDetailsForm">
                <a4j:param name="noteId" assignTo="#{chNotesAction.currentNoteId}"
                    converter="javax.faces.Long" />
            </a4j:jsFunction>
    
            <rich:dataTable id="noteTable" style="width: 100%"
                value="#{chNotesAction.notesList}" var="rs"
                rowClasses="oddrow, evenrow" columnClasses="nowrap,"
                rows="#{referenceData.recordsPerPage}" sortMode="single"
                onrowclick="selectRow('#{rs.noteLogId}')"
                rowKeyVar="currRow">
    
                <rich:column id="date">
                    <f:facet name="header">
                        <h:outputText value="#{msg.entryDate}" />
                    </f:facet>
                    <h:outputText value="#{rs.changeDate}" />
                </rich:column>
    
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.notesType}" />
                    </f:facet>
                    <h:outputText value="#{rs.noteType}" />
                </rich:column>
    
                <f:facet name="footer">
                    <rich:dataScroller renderIfSinglePage="false" for="noteTable"
                        stepControls="show" fastControls="hide" />
                </f:facet>
            </rich:dataTable>
        </h:form>
    
        <rich:popupPanel id="noteDetails" autosized="true">
            <f:facet name="header">
                <h:panelGroup>
                    <center>
                        <h:outputText value="#{msg.noteTitle}" />
                    </center>
                </h:panelGroup>
            </f:facet>
            <f:facet name="controls">
                <h:graphicImage value="/images/close.png" 
                    style="cursor:pointer" onclick="#{rich:component('noteDetails')}.hide()" />
            </f:facet>
            <h:form id="noteDetailsForm">
                <rich:messages />
    
                <h:panelGrid columns="2" columnClasses="nowrap,">
                    <h:outputText value="#{msg.notes}" />
                    <h:inputTextarea value="#{chNoteForm.noteText}" label="#{msg.notes}"
                        rows="10" cols="50" style="resize:none;">
                        <f:validateLength maximum="4000" />
                    </h:inputTextarea>
    
                    <h:outputText value="#{msg.clientInitiated}" />
                    <h:selectBooleanCheckbox value="#{chNoteForm.clientInitiated}" />
                </h:panelGrid>
            </h:form>
        </rich:popupPanel>
    

    Bean part:

        private Long currentNoteId;
        public void setCurrentNoteId(Long noteId) {
            this.currentNoteId = noteId;
            // setup popup related data here
            }
        }
    
    0 讨论(0)
提交回复
热议问题