You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by heapifyman <he...@gmail.com> on 2011/10/20 10:43:30 UTC
AjaxTabbedPanel - intercept switching tabs
Hello,
is there a default way to determine when a user switches between tabs in an
AjaxTabbedPanel?
I see onAjaxUpdate(final AjaxRequestTarget target) but that is called after
the new tab has been set.
I would like to add a confirmation dialog before the new tab is set in case
the user had changed data in the current tab.
Or should I maybe override the protected WebMarkupContainer newLink(final
String linkId, final int index) method?
Is that possible? If so any hints would be appreciated. Thanks
Re: AjaxTabbedPanel - intercept switching tabs
Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Oct 20, 2011 at 11:57 AM, manuelbarzi <ma...@gmail.com> wrote:
> may you follow something like this:
>
>
> public class AjaxTabbedPanel extends TabbedPanel
> {
>
> public AjaxTabbedPanel(String id, List<ITab> tabs)
> {
> super(id, tabs);
> setOutputMarkupId(true);
>
> setVersioned(false);
> }
>
> @Override
> protected WebMarkupContainer newLink(String linkId, final int index)
> {
> return new AjaxFallbackLink<Void>(linkId)
> {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget target)
> {
>
> // TODO: check here
Either this or return a new AjaxLink with overridden
getAjaxCallDecorator() that checks at client-side (pure JavaScript).
>
> setSelectedTab(index);
> if (target != null)
> {
> target.addComponent(AjaxTabbedPanel.this);
> }
>
> }
>
> };
> }
>
> ---------------------------------------------------------------------
> 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
Re: AjaxTabbedPanel - intercept switching tabs
Posted by manuelbarzi <ma...@gmail.com>.
may you follow something like this:
public class AjaxTabbedPanel extends TabbedPanel
{
public AjaxTabbedPanel(String id, List<ITab> tabs)
{
super(id, tabs);
setOutputMarkupId(true);
setVersioned(false);
}
@Override
protected WebMarkupContainer newLink(String linkId, final int index)
{
return new AjaxFallbackLink<Void>(linkId)
{
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target)
{
// TODO: check here
setSelectedTab(index);
if (target != null)
{
target.addComponent(AjaxTabbedPanel.this);
}
}
};
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org