You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by technimadhu <te...@gmail.com> on 2012/08/09 21:45:25 UTC

changing number of tabs

All,
Newbie here. Using Wicket 1.5.x.
How can i change the number of tabs based on dropdown choice in the form?

In my initial page contructor, I have just 1 tab. Then if user chooses a
particular value in drop down in the form, I want 3 tabs. I tried a)
form.render b) form.replace(myAjaxTabbedPanelRef)  <-- Both these throw
error saying can't render after initial render. 

So my class has these member instances
   form, atp (which is AjaxTabbedPanel) and tabList(which is List<ITab> )..
Initially I populate the tabList with only one tab like this
     
If i detect my dropdown change, i do this
      - tabList.clear() 
      - tabList.add() with 3 AbstractTab in it.
      - atp = new AjaxTabbedPanel("tabs", tabList)
      - form.replace(atp)  <<-- throws Cannot modify component hierarchy
after render phase
        Same if i try form.remove() and form.add(atp) 

How do i make the page refresh with new tabs





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/changing-number-of-tabs-tp4651102.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: changing number of tabs

Posted by Sven Meier <sv...@meiers.net>.
loadTabs() is called by your "profToCopy"'s #getObject().

That's a bad idea because a model's #getObject() might get called multiple times during render,
and maybe even when changing the component hierarchy is no longer allowed.

You should move the invokation of LoadTabs() into ElemConfigAdd#onBeforeRender().

Hope this helps
Sven



On 08/09/2012 10:19 PM, technimadhu wrote:
> My code is like below:
>
> ElemConfigAdd.html:
>
>
>
> ElemConfigAdd.java:
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/changing-number-of-tabs-tp4651102p4651105.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: changing number of tabs

Posted by technimadhu <te...@gmail.com>.
My code is like below:

ElemConfigAdd.html:



ElemConfigAdd.java:





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/changing-number-of-tabs-tp4651102p4651105.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: changing number of tabs

Posted by Sven Meier <sv...@meiers.net>.
>If i detect my dropdown change

What's that in code?

Sven


On 08/09/2012 09:45 PM, technimadhu wrote:
> All,
> Newbie here. Using Wicket 1.5.x.
> How can i change the number of tabs based on dropdown choice in the form?
>
> In my initial page contructor, I have just 1 tab. Then if user chooses a
> particular value in drop down in the form, I want 3 tabs. I tried a)
> form.render b) form.replace(myAjaxTabbedPanelRef)  <-- Both these throw
> error saying can't render after initial render.
>
> So my class has these member instances
>     form, atp (which is AjaxTabbedPanel) and tabList(which is List<ITab> )..
> Initially I populate the tabList with only one tab like this
>       
> If i detect my dropdown change, i do this
>        - tabList.clear()
>        - tabList.add() with 3 AbstractTab in it.
>        - atp = new AjaxTabbedPanel("tabs", tabList)
>        - form.replace(atp)  <<-- throws Cannot modify component hierarchy
> after render phase
>          Same if i try form.remove() and form.add(atp)
>
> How do i make the page refresh with new tabs
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/changing-number-of-tabs-tp4651102.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