| Author |
Custom component with children - Child component added at end appears as first child when rendered.
|
Keerthi P
Ranch Hand
Joined: Aug 19, 2003
Posts: 203
|
|
I have a custom JSF component that renders navigation links. The following is a typical usage of the component:
And, the rendered content will appear as following, similar to the navigation links at the top of this page:
Primary Data | Principals | Administrators | Custodiams | Accounting Firms | Law Firms | Billing
As you notice, the navigationBar component is bounded to #{testBean.navigationBar} which is defined as below in the Backing bean:
The backing bean has an action method formSubmitted() that adds a child (HtmlNavigationLink) component to the parent (HtmlNavigationBar) dynamically. I thought that this newly added child would be the last child (as it is added to end of the children list). But, when the navigationBar renders its children, the HtmlNavigationLink 'New link' appears as the first child causing the content rendered as below:
New Link | Primary Data | Principals | Administrators | Custodiams | Accounting Firms | Law Firms | Billing
The following is the encodeChildren() method of HtmlNavigationBar
As noted in the comment above, while the link was added to the end of the list in the action method, it appears at index position 0 as the first child? Why is it so?
|
Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
|
 |
Samuel March
Ranch Hand
Joined: Oct 28, 2009
Posts: 39
|
|
java.util.List uses and enumerator , also you may need to sort a list.
do your for loop with this
or
|
...did you have the fish?!............................ No.
|
 |
Keerthi P
Ranch Hand
Joined: Aug 19, 2003
Posts: 203
|
|
is same as
|
 |
Keerthi P
Ranch Hand
Joined: Aug 19, 2003
Posts: 203
|
|
I have posted a simplified case of the issue here https://issues.apache.org/jira/browse/MYFACES-2392 and here
https://facelets.dev.java.net/issues/show_bug.cgi?id=358
If anyone has any clue, please advise.
|
 |
 |
|
|
subject: Custom component with children - Child component added at end appears as first child when rendered.
|
|
|