p:commandLink doesn't work inside p:treeNode

UI Components for JSF
Post Reply
arvasko
Posts: 36
Joined: 23 Nov 2010, 15:25

28 Dec 2010, 15:42

Hi there,

I'm trying to use a p:commandLink inside p:treeNode but it doesn't work, neither in a leaf, child or parent node.

I googled this issue and seems that many people has this problem, like in here:
http://primefaces.prime.com.tr/forum/vi ... f=3&t=3976
http://code.google.com/p/primefaces/iss ... ail?id=472

I'm using Primefaces 2.2 RC2 with Glassfish 3.

Here is my XHTML:

Code: Select all

<h:form>
                <p:panel header="Results" rendered="#{alarmController.root != null}">
                    <p:tree value="#{alarmController.root}" var="alarm">                        
                        <p:treeNode type="erro">
                            <h:outputText value="#{alarm}" styleClass="erroNode"/>
                            <p:commandLink update="documentPanel" oncomplete="documentDialog.show()" title="Comment this alarm">
                                <h:outputText value="Comment here"/>
                            </p:commandLink>
                        </p:treeNode>
                    </p:tree>
                </p:panel>
</h:form>
I would appreciate any help or hint to workaround this "bug".

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Dec 2010, 17:30

Yes it is not supported and wont be until PrimeFaces 3.0 where the new tree will be introduced, right now you can try using nodeSelectListener, it is pretty much same anyway.

http://www.primefaces.org/showcase/ui/t ... onAjax.jsf

arvasko
Posts: 36
Joined: 23 Nov 2010, 15:25

07 Jan 2011, 15:53

Thanks optimus.prime for replying!

I have just one more question, and that is my real problem: how can I invoke Javascript commands from "nodeSelectListener" method?

Let me explain: when user clicks on some tree node, it should be opened a dialog with details of selected node. (Example: http://www.primefaces.org/showcase/ui/treeTable.jsf)

That is why I would prefer to use p:commandLink, but as I have to use nodeSelectListener, then I need a way to invoke "documentDialog.show()" from documentController class. I imagine there is something similar to "FacesContext.getCurrentInstance().getElement("documentDialog").show()".

pdebski
Posts: 25
Joined: 17 Jan 2011, 15:15

10 Feb 2011, 10:42

If I understand it correctly: it is impossible now to have both at the same time - checkbox selection (for selecting nodes to group edit) and single selection (for presenting details of selected node)? nodeSelectListener doesn't help because it is triggered every time I select the node with checkbox (multiselection) and I need it to trigger just in case of single selection...

The same issue is with dataTable, but there at least I can achieve a single selection by putting commandLink in one on the columns (which cannot be done in treeNode) and multiselection for group edit with checkbox.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests