On Wed, Feb 22, 2012 at 12:01 PM, Daniel Stoch <daniel.st...@gmail.com> wrote:
> No. I want to have <a>. When you use this LinkContainer from my
> example in HTML like:
> <div wicket:id="link">
> </div>
>
> It will be rendered as:
>
> <a wicket:id="link">...</a>
>
> So any attributes modified using behavior will disappear.
>
>
> But if LinkContainer will not have setRenderBodyOnly(true), the the
> corresponding HTML will be:
>
> <div wicket:id="link" class='my-link-style'>
>  <a wicket:id="link">...</a>
> </div>

Now it is more clear what you do.
You need to add the AttributeModifier to the Link, not to the
LinkContainer if you want to manipulate <a>.

>
>
> --
> DS
>
> On Wed, Feb 22, 2012 at 11:49 AM, Martin Grigorov <mgrigo...@apache.org> 
> wrote:
>> Hi,
>>
>> So you want to not have <a> (because this is what
>> .setRenderBodyOnly(true) does) and in the same time you want to set a
>> class an that non-existing tag ?!
>>
>> The easiest way is to remove the call to .setRenderBodyOnly(true).
>>
>> On Wed, Feb 22, 2012 at 11:38 AM, Daniel Stoch <daniel.st...@gmail.com> 
>> wrote:
>>> Hi,
>>>
>>> Is it possible to modify tag attribute (eg. add a CSS class) of
>>> component which has set renderBodyOnly flag to true?
>>> When using component.add(new AttributeModifier(...)) it has no effect,
>>> because a tag in which this class attribute is appended is not
>>> rendered in HTML (because of setRenderBodyOnly(true)).
>>>
>>> Here is an example:
>>> LinkContainer is a component (extends Panel) which has 
>>> setRenderBodyOnly(true).
>>>
>>> <wicket:panel>
>>>        <a wicket:id="link"><wicket:container wicket:id="linkContent">[link
>>> content]</wicket:container></a>
>>> </wicket:panel>
>>>
>>> Somewhere inside a page or panel:
>>> add(new LinkContainer("link", ...).add(new AttributeModifier("class",
>>> Model.of("my-link-style"))));
>>> But of course this " class='my-link-style' " will not be rendered anywhere.
>>>
>>> I want to add a class attribute to contained <a> tag but using a
>>> behavior which can be added to the whole LinkContainer. Is it any
>>> simple solution to achieve this?
>>>
>>> --
>>> DS
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to