You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by khanshan <ha...@yahoo.com> on 2012/04/20 13:37:56 UTC

Tab onclick behaviour.

Hello everyone, I an new on wicket. And I am stucked!!!

I have a tabbed page. and I want to implement for each tab different
behaviour from database acording to onClick of each tab.

here you can see markup.
---------------------
< div wicket:id="tabs">
<ul>
<li> #tabs-1 Tab1 </li>
<li> #tabs-2 Tab2 </li>
</ul>
<div id="tabs-1" wicket:id="first"> ......</div>
<div id="tabs-2" wicket:id="second"> .....</div>
< /div>



and here code.
------------------
TabsWebMarkupContainer tab;
tab = new TabsWebMarkupContainer("tabs");

tab.setOutputMarkupId(true);
tab.add(new Link("first") {
            @Override
            public void onClick() {
                System.out.println("first tab");   
            }
        });

Homeform.add(tab);
----------------

What is wrong with that code.
It should output on console "first tab" when I click first tab isnt it??


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Tab-onclick-behaviour-tp4573620p4573620.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: Tab onclick behaviour.

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Fri, Apr 20, 2012 at 2:37 PM, khanshan <ha...@yahoo.com> wrote:
> Hello everyone, I an new on wicket. And I am stucked!!!
>
> I have a tabbed page. and I want to implement for each tab different
> behaviour from database acording to onClick of each tab.
>
> here you can see markup.
> ---------------------
> < div wicket:id="tabs">
> <ul>
> <li> #tabs-1 Tab1 </li>
> <li> #tabs-2 Tab2 </li>
> </ul>
> <div id="tabs-1" wicket:id="first"> ......</div>
> <div id="tabs-2" wicket:id="second"> .....</div>
> < /div>
>
>
>
> and here code.
> ------------------
> TabsWebMarkupContainer tab;
> tab = new TabsWebMarkupContainer("tabs");
>
> tab.setOutputMarkupId(true);
> tab.add(new Link("first") {
>            @Override
>            public void onClick() {
>                System.out.println("first tab");
>            }
>        });
>
> Homeform.add(tab);
> ----------------
>
> What is wrong with that code.
> It should output on console "first tab" when I click first tab isnt it??

Yes, it should.
You are assinging a Link component to a <div>, so Wicket will add
'onclick' attribute to that <div>. See whether there are any
JavaScript errors in the browser console.

>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Tab-onclick-behaviour-tp4573620p4573620.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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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