Your suggestion: if (((IModel<Wafer>) getDefaultModel()).getObject().getId() == 0) { ArrayItemOptions<IntegerItemOptions> options = new ArrayItemOptions<IntegerItemOptions>(); for (int i = 1; i < 6; i++) { options.add(new IntegerItemOptions(i)); }
tabs.setDisabled(options); } My code sauce: if (((IModel<Wafer>) getDefaultModel()).getObject().getId() == 0) { tabs.add(new AbstractBehavior() { @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); StringBuilder js = new StringBuilder(); for (int i = 1; i < 6; i++) { js.append(tabs.disable(i).getStatement()).append(";"); } response.renderOnDomReadyJavascript(js.toString()); } }); } Yup I'm going for your suggestion. Thanks Hielke. Regards, Marco On 17 January 2012 15:05, Hielke Hoeve <hielke.ho...@topicus.nl> wrote: > > Yes I (and perhaps we) care. Unfortunately Google has decided that the > WiQuery google group should die, leaving us with no mailinglist... > Fortunately most of the WiQuery committers are also on this mailinglist. > Any suggestions you have will be taken into account during our ever lasting > upgrade efforts for WiQuery. > > Simply calling tab.disable(i); will not work as this function returns a > jQuery statement. If you do not use that nothing changes :S You should use > Tabs#setDisabled(ArrayItemOptions<IntegerItemOptions> disabled). This will > disable all tabs that you specify upon first render. If you want to disable > any tab after first render you should use an ajax call and call > Tabs#disable(AjaxRequestTarget, int). > > If there is a bug in WiQuery then please report it here: > http://code.google.com/p/wiquery/issues/entry > > Hielke Hoeve > > -----Original Message----- > From: Marco Springer [mailto:marcosprin...@gmail.com] > Sent: dinsdag 17 januari 2012 9:16 > To: users@wicket.apache.org > Subject: Re: WiQuery & disabling tabs > > 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()); > } > }); > > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org