Filtering datatable

UI Components for JSF
Post Reply
Babas007
Posts: 251
Joined: 24 May 2011, 09:42

14 Jul 2011, 15:00

Hi everyone,

Trying the example about filtering a datable, it works very well, except instead to use the rowselect event I use a commandButton such as:

Code: Select all

<p:dataTable var="policy" value="#{policyController.allPolicies}" selection="#{policyController.selectedPolicy}" paginator="true" rows="10" >  
                    <f:facet name="header">  
                        List of Policy  
                    </f:facet>  

                    <p:column styleClass="subject">  
                        <f:facet name="header">  
                            <h:outputText value="Subject / Role" />  
                        </f:facet> 
                        <h:outputText value="#{policyController.getDataOwner(policy)}" /> 
                    </p:column>  

                    <p:column styleClass="decision" filterBy="#{policy.decision}" filterOptions="#{policyView.decisionItems}" >  
                        <f:facet name="header">  
                            <h:outputText value="Decision" />  
                        </f:facet>  
                        <h:outputText value="#{policy.decision}" />  
                    </p:column>  

                    <p:column >  
                        <f:facet name="header" >  
                            <h:outputText value="Resource" />  
                        </f:facet>  
                        <h:outputText value="#{policy.resource}" />  
                    </p:column>  

                    <p:column headerText="Manage" styleClass="manage">  
                        <h:panelGrid columns="3">  
                            <p:commandButton update=":form:display" oncomplete="policyDialog.show()" image="ui-icon ui-icon-search" title="View" process="@this" >  
                                <f:setPropertyActionListener value="#{policy}" target="#{policyController.selectedPolicy}" />  
                                <f:setPropertyActionListener value="#{false}" target="#{policyController.editMode}" />  
                            </p:commandButton>  
                            <p:commandButton update=":form:display" oncomplete="policyDialog.show()" image="ui-icon ui-icon-pencil" title="Edit" process="@this">  
                                <f:setPropertyActionListener value="#{policy}" target="#{policyController.selectedPolicy}" />  
                                <f:setPropertyActionListener value="#{true}" target="#{policyController.editMode}" />  
                            </p:commandButton>  
                            <p:commandButton update=":form:display" oncomplete="confirmation.show()" image="ui-icon ui-icon-close" title="Delete" process="@this">  
                                <f:setPropertyActionListener value="#{policy}" target="#{policyController.selectedPolicy}" />  
                            </p:commandButton>
                        </h:panelGrid>  
                    </p:column> 
                </p:dataTable>
So, when the collection is filtered and trying to get details about the selected object, it displays the object on the collection before that the collection be filtered...I'm using exactly the same code in my commandButton than the p:ajax. (i guess). How to force the update?

kind regards,
kind regards,

Babas007
Posts: 251
Joined: 24 May 2011, 09:42

15 Jul 2011, 17:19

I think i was not clear, to do simple, I would like to mix this example http://www.primefaces.org/showcase-labs ... Column.jsf with this one http://www.primefaces.org/showcase-labs ... tering.jsf. So, what i want is when I click on a button on the right, I would like to display details. (after filtering)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 52 guests