This content has been marked as final.
Show 3 replies
-
1. Re: rich:tree onselected issue
nbelaevski Nov 14, 2008 1:36 PM (in response to amudumbi)Hi,
Why do not put confirmation on h:commandLink itself? -
2. Re: rich:tree onselected issue
amudumbi Nov 14, 2008 1:53 PM (in response to amudumbi)"nbelaevski" wrote:
Hi,
Why do not put confirmation on h:commandLink itself?
Problem with that is, if user clicks cancel, it still is showing the newly selected node as selected, by drawing a box around it. If I put it on select, at least it toggles. Ideally I don't event want toggle. It shouldn't change the selected node on UI till user decides one way or the other.
I don't know, whatever I try seems to break something else. That is why I feel I may be missing something fundamental to begin with.
Thanks -
3. Re: rich:tree onselected issue
amudumbi Nov 14, 2008 2:49 PM (in response to amudumbi)Not sure exactly why it has to be this way, but I took clues from the following blog entry http://mkblog.exadel.com/?p=161 and the following code seems to work so far.
-Thanks<ui:composition> <script type="text/javascript"> <!-- Edit screen sets this variable when there are user changes on the screen --> var somethingChanged = false; function confirmChanges(){ if(somethingChanged){ if(!confirm("#{msgs['changes.confirm']}")) return false; } return true; } function dslList(){ if(!confirmChanges()) return false; goToList(); return false; } function dslEdit() { if(!confirmChanges()) return false; goToEdit(); return false; } </script> <rich:panel id="nav" header="#{msgs['nav.header.title']}" styleClass="nav" headerClass="navHeader"> <h:form style="height:100%"> <rich:tree style="width:200px" switchType="client" value="#{navBean.root}" var="item" nodeFace="#{item.type}" nodeSelectListener="#{navBean.processSelection}" stateAdvisor="#{navBean}" > <rich:treeNode type="ROOT" onselected="return dslList()"> <h:commandLink value="#{item.name}" /> </rich:treeNode> <rich:treeNode type="DSL" onselected="return dslEdit()"> <h:commandLink value="#{item.name}" /> </rich:treeNode> </rich:tree> <a4j:jsFunction name="goToEdit" action="edit"/> <a4j:jsFunction name="goToList" action="dslList"/> </h:form> </rich:panel> </ui:composition>