You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Cristi Manole <cr...@gmail.com> on 2007/10/30 21:51:05 UTC

Dynamically changing CSS

Hello,

I have a checkbox in an Ajax table (wrote by Igor).

On one column i add a panel which contains a checkbox and a link.

When the user selects the checkbox I would like that specific table row to
be displayed with a different background color.

How am I to do that? I didn't manage to understand how to get the row id
(although that is probably trivial) and how to change the css (I'm thinking
of doing that through javascript, with  appendJavascript method, but on
which element to call it?)

Thanks in advance.

Re: Dynamically changing CSS

Posted by Cristi Manole <cr...@gmail.com>.
works perfectly.

tks a mill.

On 10/31/07, Timo Rantalaiho <Ti...@ri.fi> wrote:
>
> On Wed, 31 Oct 2007, Cristi Manole wrote:
> > Tks a lot for your reply, but how do I do "get wicket to change the
> style
> > color" of that speciffic row, exactly? that part I don't know... :(
>
> Something like
>
> final Component row = ...
> row.add(new AttribubuteModifier("class", true, new
>     AbstractReadOnlyModel() {
>         public Object getObjext() {
>             if (isSelected(row)) {
>                 return "trhighlight";
>             }
>             return "trdefault";
>         }
>     });
>
> or if you don't want to change the style attribute by default,
> you can only enable the attributemodifier as needed
>
> row.add(new AttribubuteModifier("class", true, new
>     AbstractReadOnlyModel() {
>         public Object getObjext() {
>             return "trhighlight";
>             }
>         }
>
>         @Override
>         public boolean isEnabled() {
>             return isSelected(row);
>         }
>     });
>
> Best wishes,
>
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Dynamically changing CSS

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Wed, 31 Oct 2007, Cristi Manole wrote:
> Tks a lot for your reply, but how do I do "get wicket to change the style 
> color" of that speciffic row, exactly? that part I don't know... :(

Something like 

final Component row = ...
row.add(new AttribubuteModifier("class", true, new
    AbstractReadOnlyModel() {
        public Object getObjext() {
	    if (isSelected(row)) {
	        return "trhighlight";
	    }
	    return "trdefault";
	}
    });

or if you don't want to change the style attribute by default,
you can only enable the attributemodifier as needed

row.add(new AttribubuteModifier("class", true, new
    AbstractReadOnlyModel() {
        public Object getObjext() {
	    return "trhighlight";
	    }
	}

	@Override
	public boolean isEnabled() {
	    return isSelected(row);
	}
    });

Best wishes,

Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: Dynamically changing CSS

Posted by Cristi Manole <cr...@gmail.com>.
Tks a lot for your reply, but how do I do "get wicket to change the style 
color" of that speciffic row, exactly? that part I don't know... :(

----- Original Message ----- 
From: "Jon Laidler" <zo...@ozemail.com.au>
To: <us...@wicket.apache.org>
Sent: Tuesday, October 30, 2007 11:51 PM
Subject: Re: Dynamically changing CSS


>
> You could use CSS. Set the class for the table row to be highlighted (eg 
> ..tr
> class="trcolor"), add a style to the page to set the color of the table 
> row
> class (eg .trcolor {color: red} ). Then get wicket to change the style 
> color
> through CSS when the checkbox is selected.
>
>
>
> Cristi Manole wrote:
>>
>> Hello,
>>
>> I have a checkbox in an Ajax table (wrote by Igor).
>>
>> On one column i add a panel which contains a checkbox and a link.
>>
>> When the user selects the checkbox I would like that specific table row 
>> to
>> be displayed with a different background color.
>>
>> How am I to do that? I didn't manage to understand how to get the row id
>> (although that is probably trivial) and how to change the css (I'm
>> thinking
>> of doing that through javascript, with  appendJavascript method, but on
>> which element to call it?)
>>
>> Thanks in advance.
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Dynamically-changing-CSS-tf4721192.html#a13498438
> 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
> 


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


Re: Dynamically changing CSS

Posted by Jon Laidler <zo...@ozemail.com.au>.
You could use CSS. Set the class for the table row to be highlighted (eg ..tr
class="trcolor"), add a style to the page to set the color of the table row
class (eg .trcolor {color: red} ). Then get wicket to change the style color
through CSS when the checkbox is selected.



Cristi Manole wrote:
> 
> Hello,
> 
> I have a checkbox in an Ajax table (wrote by Igor).
> 
> On one column i add a panel which contains a checkbox and a link.
> 
> When the user selects the checkbox I would like that specific table row to
> be displayed with a different background color.
> 
> How am I to do that? I didn't manage to understand how to get the row id
> (although that is probably trivial) and how to change the css (I'm
> thinking
> of doing that through javascript, with  appendJavascript method, but on
> which element to call it?)
> 
> Thanks in advance.
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-changing-CSS-tf4721192.html#a13498438
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