I didn't clearly understand the question. But another shot in the dark ;) You mean, is the behaviour of the ajax link depends on the clicked item ? If that's what you mean, then I like to be able to disable the clicked link while viewing the corresponding panel.
The second part about the onchange event, I didn't get it at all. Can you please kindly elaborate. I am not new to wicket, but not very advnaced either. Thank you. On Tue Feb 22,2011 11:35 am, Mike Mander wrote: > A shot in the dark. > > Is the behavior required at the select? Or is the option getting the > onchange event? > > Cheers > Mike > > I'm using the select component due to realizing a dynamic optgroup and > > option > > list. > > It works rather fine but my problem is to get the selected value. > > I tried to use an ajax behavior (AjaxComponentUpdatingBehavior, > > OnChangeBehavior) but the onUpdate methode is never called --> doesn't > > work! > > > > Maybe there is a solution for my problem!? What I'm doing wrong? > > > > My code: > > > > > > Select select = new Select(selectId); > > select.add(new ListView("optGroups", myList) { > > > > @Override > > protected void populateItem(ListItem item) { > > MyBean myBean = (MyBean) item.getModelObject(); > > item.add(new OptGroup("optGroup", myBean.getName(), myBean.getList())); > > } > > }); > > > > add(select); > > > > > > class OptGroup extends SelectOption { > > > > String label; > > > > List<MyBean2> list; > > > > public OptGroup(String id, String label, List<MyBean2> list) { > > super(id); > > this.label = label; > > this.list = list; > > init(); > > } > > > > @SuppressWarnings("unchecked") > > private void init() { > > this.add(new ListView("grpOptions", list) { > > > > @Override > > protected void populateItem(ListItem item) { > > MyBean2 myBean2 = (MyBean2) item.getModelObject(); > > item.add(new CustomSelectOption("grpOption", > > myBean2.getName())); > > } > > > > }); > > } > > > > protected void onComponentTag(final ComponentTag tag) { > > checkComponentTag(tag, "optgroup"); > > Select select = (Select) findParent(Select.class); > > if (select == null) { > > throw new WicketRuntimeException( > > "OptGroup component [" > > + getPath() > > + "] cannot > > find its parent Select. All OptGroup components must be > > a child of or below in the hierarchy of a Select component."); > > } > > > > tag.put("label", label); > > } > > } > > > > public class CustomSelectOption extends SelectOption { > > @SuppressWarnings("unchecked") > > public CustomSelectOption(String id, String displayValue) { > > super(id, new Model(displayValue)); > > } > > > > protected void onComponentTagBody(final MarkupStream markupStream, final > > ComponentTag openTag) { > > replaceComponentTagBody(markupStream, openTag, > > getDefaultModelObjectAsString()); > > } > > } > > > > > > > > > > I tried this, but it doesn't work: > > > > > > select.add(new AjaxFormComponentUpdatingBehavior("onchange") { > > protected void onUpdate(AjaxRequestTarget target) { > > System.out.println("Update ajax"); > > // @todo updating model > > } > > }); > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org