-
1. Re: How to call action method and Invoke a Popup when user clicks on s:link
mchepuri.muralimanohar.chepuri.gmail.com Mar 18, 2009 1:32 AM (in response to mchepuri.muralimanohar.chepuri.gmail.com)Formatted code.
<a:form> <s:link value="Click here for popup1" action="#{bean.showPopup1}"/> <rich:modalPanel id="popUp1" rendered="#{bean.displayPopup1}" showWhenRendered="true" > <!--code for search region --> <s:link value="Search" action="#{bean.searchBy}"/> <!--Results--> <rich:dataTable> <rich:columm> <!--Click here for popup2--> <s:link value="#{row.someValue}" action="#{bean.showPopup2}"/> <rich:column> </rich:dataTable> </rich:modalPanel> </a:form>
-
2. Re: How to call action method and Invoke a Popup when user clicks on s:link
kragoth Mar 18, 2009 1:43 AM (in response to mchepuri.muralimanohar.chepuri.gmail.com)Please post you SEAM bean code as well. It looks like that would be where the problem could be.
-
3. Re: How to call action method and Invoke a Popup when user clicks on s:link
mchepuri.muralimanohar.chepuri.gmail.com Mar 18, 2009 1:54 AM (in response to mchepuri.muralimanohar.chepuri.gmail.com)Here is SEAM bean code.
@Name("bean") Class Bean{ public boolean displayPopUp1; public void showPopup1(){ this.displayPopUp1=true; } public void searchBy(){ .... some code .... showPopup1();//to show popup again after user hits on search } public void showPopup2(){ //code to show popup2 } public boolean isDisplayPopUp1(){ return displayPopUp1; } publiv void setDisplayPopUp1(boolean displayPopUp1){ this.displayPopUp1=displayPopUp1; } }
please let me know if this is not sufficient ....
Thanks
Murali -
4. Re: How to call action method and Invoke a Popup when user clicks on s:link
kragoth Mar 18, 2009 2:37 AM (in response to mchepuri.muralimanohar.chepuri.gmail.com)Well, my first assumption is that based on the fact that your SEAM bean has no @Scope annotation then your seam bean will default to EVENT scope.
This means that your seam bean is getting recreated every event. So all your state is essentially lost on every request.
Try using @Scope(ScopeType.CONVERSATION) on your bean and see how that goes.
I would really recommend reading some more SEAM documentation so you understand a bit more about the lifecycle of SEAM components.
-
5. Re: How to call action method and Invoke a Popup when user clicks on s:link
dxxvi Mar 18, 2009 11:31 AM (in response to mchepuri.muralimanohar.chepuri.gmail.com)I guess your reason to use s:link is that you don't want to submit the form, right? If that's the case then you can refer to my example
<a:form> <a:commandLink value="Click here for popup1" action="#{bean.showPopup1}" oncomplete="#{rich:component('popUp1')}.show()" ajaxSingle="true" reRender="popUp1"/> <!-- reason for reRender: most of the time my modal panels are used to display something, when the page is rendered, that "something" is not available yet, when the user clicks on "Click her for popup1", I prepare that "something" in the action method and re-render the modal panel to show that "something" a:commandLink will submit the form, but nothing is updated because of the ajaxSingle = "true" --> </a:form> <rich:modalPanel id="popUp1"> <a:form> <a:commandLink value="Show popup2" .../> </a:form> </rich:modalPanel> <rich:modalPanel id="popUp2">...</rich:modalPanel>
Hope that helps.
-
6. Re: How to call action method and Invoke a Popup when user clicks on s:link
mchepuri.muralimanohar.chepuri.gmail.com Mar 18, 2009 8:08 PM (in response to mchepuri.muralimanohar.chepuri.gmail.com)Hi,
Thanks a lot for your replies.
@Thai Dang Vu
I would like to request you to notice from code that i have a dataTable with in ModalPanel and with in dataTable i have a commandLink for each row.
<!--Results-->
<rich:dataTable>
<rich:columm>
<!--Click here for popup2-->
<s:link value="#{row.someValue}" action="#{bean.showPopup2}"/>
<rich:column>
</rich:dataTable>
So if i use a commandLink in place of s:link and click on someValue in dataTable to show popUp2, the action method(#{bean.showPopup2}) is not getting invoked.This is also one reason which lead me to use s:link.
So is there any way to call the action method of a commandLink with in dataTable.