Vipin
Vipin

Reputation: 398

Opening a Rich Modal Panel on Button Click

I m trying to open a rich modal panel with populated data on a button click

tried

<h:commandButton id="btn_search" value="#{text['button.add']}" 
                    action="#{cartBean.search}"
                    oncomplete="#{rich:component('dlg_results')}.show()">                            
                    </h:commandButton>

and

<h:commandButton id="btn_search" value="#{text['button.add']}" 
                    action="#{cartBean.search}" immediate="true">
                        <rich:componentControl for="dlg_results" attachTo="btn_search" operation="show" event="onclick"/>
                    </h:commandButton>

This code opens the model panel on button click but when response is sent back from the server the whole page gets refreshed

can some one suggest a way to handle this ???

Upvotes: 0

Views: 4127

Answers (2)

Vipin
Vipin

Reputation: 398

Thanks, this was helpful information.

I used showWhenRendered tag in rich:modalpanel to solve my problem. I added a variable in my bean and set its value to true on click of button if records are found.

Upvotes: 1

FRotthowe
FRotthowe

Reputation: 3662

Use <a4j:commandButton> instead of h:commandButton.

Upvotes: 2

Related Questions