You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mac <gm...@gmail.com> on 2013/03/21 15:44:52 UTC

Wicket panel - call jQuery

Hi,
I have a panel component containing
org.apache.wicket.extensions.markup.html.tabs.TabbedPanel(s):

Java (my component constructor):
List<Tab> tabs = new ArrayList<>();
...
add( new AjaxTabbedPanel<>( "menu", tabs ) );

HTML:
<div id="menu">
   <div class="tab-row">
      ...
   </div>
   <div class="tab-panel">
      ...
   </div>
   ...
</div>

I need to add a css class to "tab-row" and "tab-panel" selectors (by jQuery
I suppouse). 
I tried calling 
response.render( JavaScriptHeaderItem.forScript( "$("#menu >
.tab-row").addClass("myClass");", "someId" ) );
inside myComponent#renderHead but without any success.
			
Maybe my way is not correct? Thanks for any help.

mac



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-panel-call-jQuery-tp4657401.html
Sent from the Users forum 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


Re: Wicket panel - call jQuery

Posted by Jered Myers <je...@maplewoodsoftware.com>.
I am not positive, but your selector appears wrong to me.  Try 
response.render( DomReadyHeaderItem.forScript( 
"$(\"#menu\").find(\".tab-row\").addClass(\"myClass\");", "someId" ) );

On 03/21/2013 07:50 AM, Ernesto Reinaldo Barreiro wrote:
> try with DomReadyHederItem to see if you get a different behavior.
>
> On Thu, Mar 21, 2013 at 3:44 PM, mac <gm...@gmail.com> wrote:
>
>> Hi,
>> I have a panel component containing
>> org.apache.wicket.extensions.markup.html.tabs.TabbedPanel(s):
>>
>> Java (my component constructor):
>> List<Tab> tabs = new ArrayList<>();
>> ...
>> add( new AjaxTabbedPanel<>( "menu", tabs ) );
>>
>> HTML:
>> <div id="menu">
>>     <div class="tab-row">
>>        ...
>>     </div>
>>     <div class="tab-panel">
>>        ...
>>     </div>
>>     ...
>> </div>
>>
>> I need to add a css class to "tab-row" and "tab-panel" selectors (by jQuery
>> I suppouse).
>> I tried calling
>> response.render( JavaScriptHeaderItem.forScript( "$("#menu >
>> .tab-row").addClass("myClass");", "someId" ) );
>> inside myComponent#renderHead but without any success.
>>
>> Maybe my way is not correct? Thanks for any help.
>>
>> mac
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Wicket-panel-call-jQuery-tp4657401.html
>> Sent from the Users forum 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: Wicket panel - call jQuery

Posted by mac <gm...@gmail.com>.
Thanks, it workes perfectly.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-panel-call-jQuery-tp4657401p4657404.html
Sent from the Users forum 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


Re: Wicket panel - call jQuery

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
try with DomReadyHederItem to see if you get a different behavior.

On Thu, Mar 21, 2013 at 3:44 PM, mac <gm...@gmail.com> wrote:

> Hi,
> I have a panel component containing
> org.apache.wicket.extensions.markup.html.tabs.TabbedPanel(s):
>
> Java (my component constructor):
> List<Tab> tabs = new ArrayList<>();
> ...
> add( new AjaxTabbedPanel<>( "menu", tabs ) );
>
> HTML:
> <div id="menu">
>    <div class="tab-row">
>       ...
>    </div>
>    <div class="tab-panel">
>       ...
>    </div>
>    ...
> </div>
>
> I need to add a css class to "tab-row" and "tab-panel" selectors (by jQuery
> I suppouse).
> I tried calling
> response.render( JavaScriptHeaderItem.forScript( "$("#menu >
> .tab-row").addClass("myClass");", "someId" ) );
> inside myComponent#renderHead but without any success.
>
> Maybe my way is not correct? Thanks for any help.
>
> mac
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-panel-call-jQuery-tp4657401.html
> Sent from the Users forum 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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>