You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ernesto Reinaldo Barreiro <re...@gmail.com> on 2009/07/01 07:26:17 UTC

Re: help with ListMultipleChoice and ajax tab

I see two possible solutions...

1- Replace AYAX link with an AJAX submit link, so switching tabs will do a
submit of your selected choices.
2- Have  "visual" tabs where both tabs are rendered at the same time and
switching between them is just hiding/showing them via JavaScript. That way
no data is lost...

Best,

Ernesto

On Tue, Jun 30, 2009 at 7:56 PM, Eyal Golan <eg...@gmail.com> wrote:

> Hi,
> I have a tab panel that has two tabs.
> The tabs are Ajaxified using some examples I found here and in the web.
> Basically in the tab panel we did this:
>    @Override
>    protected WebMarkupContainer newLink(String linkId, final int index) {
>        final WebMarkupContainer c = new TabbedIndicatingAjaxLink(linkId,
> index);
>        final BrowserTab tab = ((BrowserTab) getTabs().get(index));
>        c.setEnabled(tab.isEnabled());
>        return c;
>    }
>
> and TabbedIndicatingAjaxLink has this (among other changes):
>        @Override
>        public void onClick(AjaxRequestTarget target) {
>            setSelectedTab(index);
>            if (target != null) {
>                target.addComponent(CustomAjaxTabbedPanel.this);
>            }
>            onAjaxUpdate(target);
>        }
>
> Everything works just fine.
> The problem is with the ListMultipleChoice.
> Each tab has this list and the list is used with PropertyModel.
> The data of the model is only set when I press the submit (as expected).
> So what happens is that I select some values and then go to another tab and
> when going back to the first one, the selection disappears.
> I want to keep the selection.
>
> Is there a way of doing it? Like listening to the clicks or something?
>
> Thanks,
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>

Re: help with ListMultipleChoice and ajax tab

Posted by Eyal Golan <eg...@gmail.com>.
Ernesto,Thanks a-lot.
I keep forgetting about AjaxSubmitLink - That was the answer.

I thought about the JS option.
Using a module from wicketstuff for it is no option as in our company
licensing takes way too much time.
Creating my own JS for this would have taken lots of time.

So, AjaxSubmitLink... Hope not to forget it next time :)

Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Wed, Jul 1, 2009 at 8:26 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> I see two possible solutions...
>
> 1- Replace AYAX link with an AJAX submit link, so switching tabs will do a
> submit of your selected choices.
> 2- Have  "visual" tabs where both tabs are rendered at the same time and
> switching between them is just hiding/showing them via JavaScript. That way
> no data is lost...
>
> Best,
>
> Ernesto
>
> On Tue, Jun 30, 2009 at 7:56 PM, Eyal Golan <eg...@gmail.com> wrote:
>
> > Hi,
> > I have a tab panel that has two tabs.
> > The tabs are Ajaxified using some examples I found here and in the web.
> > Basically in the tab panel we did this:
> >    @Override
> >    protected WebMarkupContainer newLink(String linkId, final int index) {
> >        final WebMarkupContainer c = new TabbedIndicatingAjaxLink(linkId,
> > index);
> >        final BrowserTab tab = ((BrowserTab) getTabs().get(index));
> >        c.setEnabled(tab.isEnabled());
> >        return c;
> >    }
> >
> > and TabbedIndicatingAjaxLink has this (among other changes):
> >        @Override
> >        public void onClick(AjaxRequestTarget target) {
> >            setSelectedTab(index);
> >            if (target != null) {
> >                target.addComponent(CustomAjaxTabbedPanel.this);
> >            }
> >            onAjaxUpdate(target);
> >        }
> >
> > Everything works just fine.
> > The problem is with the ListMultipleChoice.
> > Each tab has this list and the list is used with PropertyModel.
> > The data of the model is only set when I press the submit (as expected).
> > So what happens is that I select some values and then go to another tab
> and
> > when going back to the first one, the selection disappears.
> > I want to keep the selection.
> >
> > Is there a way of doing it? Like listening to the clicks or something?
> >
> > Thanks,
> >
> >
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> >
>