By the way, I tested this out and it works.  Just use a model that you
can change (perhaps a property model) in your onClick() method.

On Fri, Apr 17, 2009 at 11:41 PM, James Carman
<[email protected]> wrote:
> 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