6 Replies Latest reply on Jan 5, 2010 8:56 AM by dandausch

    Design suggestions with extendedDataTable & commandButton

    dandausch
      I am not sure how to approach the implementation of a user requirement so any suggestions would be appreciated. I have an extendedDataTable to display a List<Bean> of data. This is working fine. For each row, there is a column that needs to contain a set of command buttons (e.g., Approve,Deny,Details). I assume I would use an a4j:commandButton for each one. What is not clear is how to wire this together. When clicking on one of these command buttons, I assume I would use a ModalPanel in order to display more details from that row and allow the user to take appropriate action. How do I wire this together? How do I refer to a row of data in the table in order to display it in the ModalPanel? Are my assumptions correct about what to use here? Any thoughts, ideas, code snippets are appreciated.
        • 1. Re: Design suggestions with extendedDataTable & commandButton
          nbelaevski

          Hi Daniel,

           

          Please check corresponding example at richfaces-demo.

          • 2. Re: Design suggestions with extendedDataTable & commandButton
            dandausch
            I have looked at the examples multiple times and continuing to examine some web examples also. I can't seem to get the 'selection' attribute to work as shown in the extendedDataTable example,  so looking for alternatives. Also looking for best practices from people also in terms of how to tie together, row selection, command link, modal panel, etc.
            • 3. Re: Design suggestions with extendedDataTable & commandButton

              Try looking here http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable&cid=5059845

               

              I assume this will work with <rich:extendedDataTable> but haven't tried it

              1 of 1 people found this helpful
              • 4. Re: Design suggestions with extendedDataTable & commandButton
                dandausch
                Ian, thanks for pointing me to that example - it did help. I am able to bring up the modal panel successfully now and I believe I am close to a solution. The remaining issue has to do with the row context to be used on the modal panel. It does not seem that the 

                <

                 

                f:setPropertyActionListener>

                tag is working properly. Here is my code:

                 

                main page:

                ---------------------------

                 

                <h:form id="form_mgr_pendingrequests">

                 

                <ui:include src="modalPanels/approveReq.xhtml"/>

                 

                <a4j:region>

                 

                <rich:extendedDataTable id="mgr_pendingrequests" rowKeyVar="rkv"

                 

                 

                value="#{RequestWorkflowController.managerPendingRequests}" var="pending"

                 

                 

                rows="0" height="255px" width="890px">

                <rich:column.... data display here

                 

                 

                <rich:column width="230px" style="padding:0" headerClass="head2">

                 

                <f:facet name="header">

                 

                <h:outputText value="Action"/>

                 

                </f:facet>

                 

                 

                <a4j:commandButton value="Approve" ajaxSingle="true" id="approveButton"

                 

                 

                oncomplete="#{rich:component('approveReq')}.show()"

                 

                 

                reRender="approveReqDiv">

                 

                 

                <f:setPropertyActionListener value="#{pending}"

                 

                 

                target="#{RequestWorkflowController.currentItem}"/>

                 

                ------------------------------

                such that I have added a methods to my backing bean called: RequestWorkflowController.setCurrentItem & getCurrentItem. I expect this method to be invoked and the current item to be stored in the Session bean.

                 

                My modalPanel is as follows:

                 

                 

                <rich:modalPanel id="approveReq" autosized="true" width="400">

                 

                <f:facet name="header">

                 

                <h:panelGroup>

                 

                <h:outputText>Approve Request</h:outputText>

                 

                </h:panelGroup>

                 

                </f:facet>

                 

                 

                <div id="approveReqDiv">

                 

                 

                <h:form id="approveForm">

                 

                <h:panelGrid id="approveForm" columns ="3">

                 

                 

                <h:outputText id="approve1label" style="font-weight:normal"

                 

                 

                value="Access Level: "></h:outputText>

                 

                <h:outputText id="approve1" style="font-weight:normal"

                 

                 

                value="#{RequestWorkflowController.currentItem.accessLevel}"></h:outputText>

                 

                <a4j:commandButton value="Approve"

                 

                 

                oncomplete="#{rich:component('approveReq')}.hide()"/>

                 

                </h:panelGrid>

                 

                </h:form>

                 

                </div>

                 

                </rich:modalPanel>

                 

                -------------------------------

                In the modalPanel, i expect the getCurrentItem.getAccessLevel to be invoked and display the current selected data. The issue seems to be the Setter and Getters not being invoked properly. I have seen other postings indicating this can be an issue. Any thoughts or suggestions?

                 

                • 5. Re: Design suggestions with extendedDataTable & commandButton
                  ilya_shaikovsky
                  Just download full sources of richfaces-demo from SVN and investigate.  http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo
                  • 6. Re: Design suggestions with extendedDataTable & commandButton
                    dandausch
                    I was able to get this to work. Thanks for the suggestions.