Quantcast

Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

akarypid
Hello,

I want to add menus (as in a menu bar with drop-down menus) on my pages.
In order to achieve that, I must use a nested RepeatingView (see further
down for the explanation). What I need (and don't know how to do) is to be
able to have markup like this:

        <ul class="web-menu">
                <li wicket:id="menuBarChoices">
                        <ul>
                                <li wicket:id="menuBarChoiceItems"></li>
                        </ul>
                </li>
        </ul>

In my code, I would use RepeatingView to generate a number of list-items  
(menuBarChoices) which would be rendered as a menu bar. In addition I  
would need to create a NESTED RepeatingView per each of the  
"menuBarChoices", to generate a number of list-items (menuBarChoiceItems).  
These would be rendered as a drop-down menu when the user hovers over the  
respective menu bar choice.

I tried to do that, but Wicket catches my attempt to nest the  
RepeatingView components and politely explains that the "outer" component  
"discard" its content, therefore the nested "embedded" component can no  
longer be used for dynamic content. The message is as follows:

"Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'  
Possible attempt to embed component(s) '<li  
wicket:id="menuBarChoiceItems">' in the body of this component which  
discards its body."

Ultimately, I need Wicket to produce something like this:

<ul class="web-menu">
        <li>
                Menu1
                <ul>
                        <li>Menu Subitem 1</li>
                        <li>Menu Subitem 2</li>
                </ul>

        </li>
        <li>
                Menu2
                <ul>
                        <li>Menu Subitem 1</li>
                        <li>Menu Subitem 2</li>
                </ul>
        </li>
</ul>

How do I go about doing that?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

James Carman
Check out the YUI menu support in wicketstuff.  It works great for us.

On Sun, Apr 24, 2011 at 4:41 PM, Alexandros Karypidis <[hidden email]> wrote:

> Hello,
>
> I want to add menus (as in a menu bar with drop-down menus) on my pages.
> In order to achieve that, I must use a nested RepeatingView (see further
> down for the explanation). What I need (and don't know how to do) is to be
> able to have markup like this:
>
>        <ul class="web-menu">
>                <li wicket:id="menuBarChoices">
>                        <ul>
>                                <li wicket:id="menuBarChoiceItems"></li>
>                        </ul>
>                </li>
>        </ul>
>
> In my code, I would use RepeatingView to generate a number of list-items
> (menuBarChoices) which would be rendered as a menu bar. In addition I would
> need to create a NESTED RepeatingView per each of the "menuBarChoices", to
> generate a number of list-items (menuBarChoiceItems). These would be
> rendered as a drop-down menu when the user hovers over the respective menu
> bar choice.
>
> I tried to do that, but Wicket catches my attempt to nest the RepeatingView
> components and politely explains that the "outer" component "discard" its
> content, therefore the nested "embedded" component can no longer be used for
> dynamic content. The message is as follows:
>
> "Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'
> Possible attempt to embed component(s) '<li wicket:id="menuBarChoiceItems">'
> in the body of this component which discards its body."
>
> Ultimately, I need Wicket to produce something like this:
>
> <ul class="web-menu">
>        <li>
>                Menu1
>                <ul>
>                        <li>Menu Subitem 1</li>
>                        <li>Menu Subitem 2</li>
>                </ul>
>
>        </li>
>        <li>
>                Menu2
>                <ul>
>                        <li>Menu Subitem 1</li>
>                        <li>Menu Subitem 2</li>
>                </ul>
>        </li>
> </ul>
>
> How do I go about doing that?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

akarypid
Hi,

I actually managed to get around this by creating a component called  
DropDownMenu with the following HTML:

<html xmlns:wicket>
        <body>
                <wicket:panel>
                        <span wicket:id="menu"></span>
                        <ul>
                                <li wicket:id="menuChoices"></li>
                        </ul>
                </wicket:panel>
        </body>
</html>

The DropDownMenu.java code creates a repeating view (the nested one) and  
adds the "menuChoices".

Then, I simply add instances of "new DropDownMenu(...)" to the "outer"  
RepeatingView which I've also converted into a separate "MenuBar"  
component.

On Mon, 25 Apr 2011 00:13:46 +0300, James Carman  
<[hidden email]> wrote:

> Check out the YUI menu support in wicketstuff.  It works great for us.
>
> On Sun, Apr 24, 2011 at 4:41 PM, Alexandros Karypidis  
> <[hidden email]> wrote:
>> Hello,
>>
>> I want to add menus (as in a menu bar with drop-down menus) on my pages.
>> In order to achieve that, I must use a nested RepeatingView (see further
>> down for the explanation). What I need (and don't know how to do) is to  
>> be
>> able to have markup like this:
>>
>>        <ul class="web-menu">
>>                <li wicket:id="menuBarChoices">
>>                        <ul>
>>                                <li wicket:id="menuBarChoiceItems"></li>
>>                        </ul>
>>                </li>
>>        </ul>
>>
>> In my code, I would use RepeatingView to generate a number of list-items
>> (menuBarChoices) which would be rendered as a menu bar. In addition I  
>> would
>> need to create a NESTED RepeatingView per each of the "menuBarChoices",  
>> to
>> generate a number of list-items (menuBarChoiceItems). These would be
>> rendered as a drop-down menu when the user hovers over the respective  
>> menu
>> bar choice.
>>
>> I tried to do that, but Wicket catches my attempt to nest the  
>> RepeatingView
>> components and politely explains that the "outer" component "discard"  
>> its
>> content, therefore the nested "embedded" component can no longer be  
>> used for
>> dynamic content. The message is as follows:
>>
>> "Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'
>> Possible attempt to embed component(s) '<li  
>> wicket:id="menuBarChoiceItems">'
>> in the body of this component which discards its body."
>>
>> Ultimately, I need Wicket to produce something like this:
>>
>> <ul class="web-menu">
>>        <li>
>>                Menu1
>>                <ul>
>>                        <li>Menu Subitem 1</li>
>>                        <li>Menu Subitem 2</li>
>>                </ul>
>>
>>        </li>
>>        <li>
>>                Menu2
>>                <ul>
>>                        <li>Menu Subitem 1</li>
>>                        <li>Menu Subitem 2</li>
>>                </ul>
>>        </li>
>> </ul>
>>
>> How do I go about doing that?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...