You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by JohannesK <jo...@eficode.fi> on 2007/10/23 14:53:29 UTC

Wicket id vs. markup id (wicket-1.3.0-beta4)

Hi all

I've been using Wicket for a while now and i love it to death. Today i
encountered a perplexing problem which i haven't been able to get around. My
goal is simply to create a link that shows/hides a div when clicked, and to
create the id of that div dynamically. What i am doing now is this:

JAVA:
final ProductListView products = new ProductListView("items",
order.getItems()); // Just a ListView basically
products.setMarkupId("productlist"+item.getIndex());  // Set the markup id
to hide/show the component
products.setOutputMarkupPlaceholderTag(true);
add(products);
add(new AjaxFallbackLink("toggle"){  // Link to do the toggling.. calls a
javascript function with the id to toggle it
       @Override
	public void onClick(AjaxRequestTarget arg0) {}
        }.add(new AttributeModifier("onClick", true, new
Model("javascript:return
toggleDiv("+("productlist"+item.getIndex())+");"))));

HTML:
<td> # Click me! </td>
<div wicket:id="items">
..some stuff here...
</div>


So that should add the component with Wicket id "items" and the markup id
"productlist0" (for example). When the page is rendered this error pops up:

WicketMessage: Unable to find component with id 'items' in [MarkupContainer
[Component id = panel, page = web.page.authenticated.IndexPage, path =
2:tabs:panel.DefaultPanel, isVisible = true, isVersioned = true]]. This
means that you declared wicket:id=items in your markup, but that you either
did not add the component to your page at all, or that the hierarchy does
not match.

Now to me, that looks like it's using the markup id i set as the wicked id
of the component. Any ideas?
-- 
View this message in context: http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13363648
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Quick follow-up

Posted by JohannesK <jo...@eficode.fi>.
Thanks for both replies. 

Oliver: setOutputMarkupPlaceholderTag() calls setOutputMarkupId().

Martijn: That explains a lot :)


Oliver Lieven wrote:
> 
> Hi,
> 
> what about using products.setOutputMarkupId(true) ? 
> 
> regards,
> Oliver
> 
> 
> Martijn Dashorst wrote:
>> 
>> Is the products a repeater (ListView, RepeatingView, DataView)? Then
>> it doesn't have its own markup (see for instance
>> http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html).
>> 
>> Martijn
>> 
>> On 10/23/07, JohannesK <jo...@eficode.fi> wrote:
>>>
>>> I managed to solve that problem, but i still cannot get the markup id to
>>> show
>>> up in my div.
>>>
>>> These two calls:
>>> products.setMarkupId("productlist"+item.getIndex());
>>> products.setOutputMarkupPlaceholderTag(true);
>>>
>>> don't seem to do anything. I can change the class of the div just fine
>>> with
>>> a SimpleAttributeModifier, but for the div id i can't get it to work.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13364719
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> 
>> -- 
>> Buy Wicket in Action: http://manning.com/dashorst
>> Apache Wicket 1.3.0-beta4 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13379582
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Quick follow-up

Posted by Oliver Lieven <ol...@provantis.de>.
Hi,

what about using products.setOutputMarkupId(true) ? 

regards,
Oliver


Martijn Dashorst wrote:
> 
> Is the products a repeater (ListView, RepeatingView, DataView)? Then
> it doesn't have its own markup (see for instance
> http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html).
> 
> Martijn
> 
> On 10/23/07, JohannesK <jo...@eficode.fi> wrote:
>>
>> I managed to solve that problem, but i still cannot get the markup id to
>> show
>> up in my div.
>>
>> These two calls:
>> products.setMarkupId("productlist"+item.getIndex());
>> products.setOutputMarkupPlaceholderTag(true);
>>
>> don't seem to do anything. I can change the class of the div just fine
>> with
>> a SimpleAttributeModifier, but for the div id i can't get it to work.
>> --
>> View this message in context:
>> http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13364719
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> -- 
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13365854
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Quick follow-up

Posted by Martijn Dashorst <ma...@gmail.com>.
Is the products a repeater (ListView, RepeatingView, DataView)? Then
it doesn't have its own markup (see for instance
http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html).

Martijn

On 10/23/07, JohannesK <jo...@eficode.fi> wrote:
>
> I managed to solve that problem, but i still cannot get the markup id to show
> up in my div.
>
> These two calls:
> products.setMarkupId("productlist"+item.getIndex());
> products.setOutputMarkupPlaceholderTag(true);
>
> don't seem to do anything. I can change the class of the div just fine with
> a SimpleAttributeModifier, but for the div id i can't get it to work.
> --
> View this message in context: http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13364719
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Quick follow-up

Posted by JohannesK <jo...@eficode.fi>.
I managed to solve that problem, but i still cannot get the markup id to show
up in my div.

These two calls:
products.setMarkupId("productlist"+item.getIndex());
products.setOutputMarkupPlaceholderTag(true);

don't seem to do anything. I can change the class of the div just fine with
a SimpleAttributeModifier, but for the div id i can't get it to work.
-- 
View this message in context: http://www.nabble.com/Wicket-id-vs.-markup-id-%28wicket-1.3.0-beta4%29-tf4677248.html#a13364719
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org