Couldn't you use an AttributeModifier behavior?  The value of the
attribute can be obtained from a model.  Just make sure you update the
link itself inside the onClick()

On Fri, Apr 17, 2009 at 11:30 PM, Jeremy Thomerson
<[email protected]> wrote:
> try something like this:
>
> onClick(AjaxRequestTarget art) {
> art.appendJavascript("document.getElementById('" + getMarkupId() +
> "').className='yourcssclass'");
> }
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Fri, Apr 17, 2009 at 5:57 PM, Jason Novotny <[email protected]>wrote:
>
>>
>> Hi,
>>
>> I have code to create an ajax link and I want it to dynamically adjust its
>> css class when clicked. This doesn't work since I don't think the
>> onComponentTag is being called.
>>
>> final AjaxLink link = new AjaxLink("navlink") {
>>           @Override
>>           public void onClick(AjaxRequestTarget target) {
>>
>>                       }
>>
>>           public void onComponentTag(ComponentTag tag) {
>>               super.onComponentTag(tag);
>>               if (foo == 77) {
>>                  tag.put("class", "secondaryCurrent");
>>               }
>>           }
>>
>>       };
>>
>> Any help is greatly appreciated!
>>
>> Thanks, Jason
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

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

Reply via email to