user2061913
user2061913

Reputation: 920

How to do a double update

i have a page that uses validation (value must be set ) and this is usually updated via growl, however i also want to use the same button to if the validation has been passed successfully update a datatable

what is the best way to do this ? Select how you would like the data sorted :

                <br></br>
            </h:panelGrid>
            <p:commandButton value="#{bundle.buttonSearch}" action="#{bean.advancedSearch}" update=":growl" icon ="ui-icon-search" />

            <br></br>
            <br></br>
            <h:panelGroup id="group">
                <p:dataTable id="UserTableSearch"
                             rowKey="#{bean.userSearchResults}"
                             rendered="#{facesContext.postback}"
                             widgetVar="UserTableSearch" 
                             paginator="true" 
                             rows="10"
                             value="#{bean.userSearchResults}"
                             var="item"
                             emptyMessage="No results found."
                             scrollable="true">

Upvotes: 2

Views: 220

Answers (2)

Luiggi Mendoza
Luiggi Mendoza

Reputation: 85789

You can include two or more component ids in the update attribute of your <p:commandButton>.

<p:commandButton value="#{bundle.buttonSearch}" action="#{bean.advancedSearch}"
    update="growl group" icon ="ui-icon-search" />

Upvotes: 4

user2061913
user2061913

Reputation: 920

added an onlick command to the command button

<p:commandButton value="#{bundle.buttonSearch}" action="#{bean.advancedSearch}" onclick="update growl" update="group" icon ="ui-icon-search" />

now all working :)

Upvotes: 0

Related Questions