Ah ofcourse! Tnx.

On 17 January 2012 09:19, Martin Grigorov <mgrigo...@apache.org> wrote:

> On Tue, Jan 17, 2012 at 9:15 AM, Marco Springer <marcosprin...@gmail.com>
> wrote:
> > If anyone cares, I found "a" solution...
> >
> > I'm guessing the previous solution isn't working because the statement is
> > probably output before the page is actually rendered.
> > Therefore i did the following:
> >
> > tabs.add(new AbstractBehavior() {
> >  @Override
> >  public void renderHead(IHeaderResponse response) {
> >    super.renderHead(response);
> >    StringBuilder js = new StringBuilder();
> >    if (isNewObject) {
> >      for (int i = 1; i < 6; i++) {
> >        js.append(tabs.disable(i).getStatement()).append(";");
> >      }
> >    }
> >    response.renderOnDomReadyJavascript(js.toString());
> Move this line inside the "if". No need to render empty JS.
>
>
> >  }
> > });
> >
> > If anyone thinks this is faulty or has a better solution, I'd like to
> know!
> >
> > Kind regards,
> > Marco
> >
> > On 16 January 2012 17:20, Marco Springer <marcosprin...@gmail.com>
> wrote:
> >
> >> Hi all,
> >>
> >> *The problem: *
> >> tabs not disabled on first render.
> >>
> >> *The source:*
> >> I'm adding the "Tabs" class from WiQuery 1.2.4 like so:
> >>
> >> tabs = new Tabs("tabs");
> >> tabs.setOutputMarkupId(true);
> >>
> >> CompoundPropertyModel<Wafer> waferModel = new
> >> CompoundPropertyModel<Wafer>(getDefaultModel());
> >> tabs.add(new GeneralInfoPanel("general_info", waferModel));
> >> tabs.add(new MaterialSpecificationPanel("material_spec", waferModel));
> >> tabs.add(new LazyTabPanel("layers", waferModel, LayersFragment.class));
> >> tabs.add(new LazyTabPanel("batches", waferModel, BatchFragment.class));
> >> tabs.add(new LazyTabPanel("logbook", waferModel,
> LogbookFragment.class));
> >> tabs.add(new DocumentsPanel("documents", waferModel));
> >>
> >> *// isNewObject set to true when the Wafer object contained in the
> >> waferModel is a new Wafer.
> >> // When a new Wafer is show in this panel, disable the rest of the tabs
> >> for now:*
> >> if (isNewObject) {
> >>  for (int i = 1; i < 6; i++)
> >>  tabs.disable(i);
> >> }
> >>
> >> add(tabs);
> >>
> >>
> >> *The question:*
> >> I thought this would be a proper way to disable those tabs, apparently
> it
> >> isn't.
> >> If I call the disable function through ajax afterwards, like
> >> "disable(target, 1)", it's fine.
> >>
> >> Anyone an idea how you would disable a single (or multiple) tabs on the
> >> first initial render?
> >>
> >> Kind regards,
> >> Marco
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to