Clickably Selectable DIVs

2009-04-22 Thread Dane Laverty
I'm working on a project management application that lists all of a
project's tasks. Each task is displayed as a DIV. I want the user to be
able to select a specific task by clicking on its DIV, which would then
highlight that DIV by adding a CSS class and display some information
about the task in a separate panel.

 

I can use an AjaxFallbackLink to get the information to display, but how
can I add a CSS class when the DIV is clicked, and then remove the CSS
class when another DIV is clicked?



Re: Clickably Selectable DIVs

2009-04-22 Thread Jeremy Thomerson
Try something like this in the onClick(AjaxRequestTarget):

this.add(new SimpleAttributeModifier(class, foobar));
target.add(this);

previouslyClicked.add(new SimpleAttributeModifier(class, otherclass));
target.add(previouslyClicked);

previouslyClicked = this;

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Apr 22, 2009 at 12:52 PM, Dane Laverty danelave...@chemeketa.eduwrote:

 I'm working on a project management application that lists all of a
 project's tasks. Each task is displayed as a DIV. I want the user to be
 able to select a specific task by clicking on its DIV, which would then
 highlight that DIV by adding a CSS class and display some information
 about the task in a separate panel.



 I can use an AjaxFallbackLink to get the information to display, but how
 can I add a CSS class when the DIV is clicked, and then remove the CSS
 class when another DIV is clicked?




Re: Clickably Selectable DIVs

2009-04-22 Thread Clint Popetz
You can add an AttributeModifier to the wicket component representing
your div, which picks the correct attribute based on the model, and
add the divs to the target in your AjaxFallbackLink.onClick().

-Clint

On Wed, Apr 22, 2009 at 12:52 PM, Dane Laverty
danelave...@chemeketa.edu wrote:
 I'm working on a project management application that lists all of a
 project's tasks. Each task is displayed as a DIV. I want the user to be
 able to select a specific task by clicking on its DIV, which would then
 highlight that DIV by adding a CSS class and display some information
 about the task in a separate panel.



 I can use an AjaxFallbackLink to get the information to display, but how
 can I add a CSS class when the DIV is clicked, and then remove the CSS
 class when another DIV is clicked?



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



RE: Clickably Selectable DIVs

2009-04-22 Thread Dane Laverty
Fabulous. Thank you for the quick response!

-Original Message-
From: Jeremy Thomerson [mailto:jer...@wickettraining.com] 
Sent: Wednesday, April 22, 2009 10:58 AM
To: users@wicket.apache.org
Subject: Re: Clickably Selectable DIVs

Try something like this in the onClick(AjaxRequestTarget):

this.add(new SimpleAttributeModifier(class, foobar));
target.add(this);

previouslyClicked.add(new SimpleAttributeModifier(class,
otherclass));
target.add(previouslyClicked);

previouslyClicked = this;

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Apr 22, 2009 at 12:52 PM, Dane Laverty
danelave...@chemeketa.eduwrote:

 I'm working on a project management application that lists all of a
 project's tasks. Each task is displayed as a DIV. I want the user to
be
 able to select a specific task by clicking on its DIV, which would
then
 highlight that DIV by adding a CSS class and display some information
 about the task in a separate panel.



 I can use an AjaxFallbackLink to get the information to display, but
how
 can I add a CSS class when the DIV is clicked, and then remove the CSS
 class when another DIV is clicked?



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



Re: Clickably Selectable DIVs

2009-04-22 Thread Igor Vaynberg
you cant keep adding attribute modifiers on every click, much better to simply:

class mylink extends link {
 private string clazz;

 oncomponenttag(tag) {
super.oncomponenttag(tag);
   tag.put(class,clazz);
 }

 public void setclazz(string c) { clazz=c; }
}

-igor


On Wed, Apr 22, 2009 at 11:09 AM, Dane Laverty
danelave...@chemeketa.edu wrote:
 Fabulous. Thank you for the quick response!

 -Original Message-
 From: Jeremy Thomerson [mailto:jer...@wickettraining.com]
 Sent: Wednesday, April 22, 2009 10:58 AM
 To: users@wicket.apache.org
 Subject: Re: Clickably Selectable DIVs

 Try something like this in the onClick(AjaxRequestTarget):

 this.add(new SimpleAttributeModifier(class, foobar));
 target.add(this);

 previouslyClicked.add(new SimpleAttributeModifier(class,
 otherclass));
 target.add(previouslyClicked);

 previouslyClicked = this;

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Wed, Apr 22, 2009 at 12:52 PM, Dane Laverty
 danelave...@chemeketa.eduwrote:

 I'm working on a project management application that lists all of a
 project's tasks. Each task is displayed as a DIV. I want the user to
 be
 able to select a specific task by clicking on its DIV, which would
 then
 highlight that DIV by adding a CSS class and display some information
 about the task in a separate panel.



 I can use an AjaxFallbackLink to get the information to display, but
 how
 can I add a CSS class when the DIV is clicked, and then remove the CSS
 class when another DIV is clicked?



 -
 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