java - Return list of checked checkboxes from Javascript to Wicket -
i trying make filter searchfield number of checkboxes can checked choose people want search. trying checkgroup component not have submit button not know how can retrieve latest checked objects. 1 thought of doing using javascript, call function in javascript , retrieve checkboxes that. have following code in wicket. question how , if possible not javascript. have tried using ajaxformchoicecomponentbehaviour , works since post whenever checkbox checked, think js better option.
public filter(string id) { super(id); form = new form("filterform"); types = resultitemhandlerpool.gettypes(); checkgroup = new checkgroup<class<?>>("checkgroup", new propertymodel<collection<class<?>>>(this,"types")); listview typeslistview = new listview<class<?>>("typeslist", new propertymodel<list<? extends class<?>>>(this,"types")) { @override protected void populateitem(final listitem<class<?>> item) { item.add(new check<class<?>>("check", item.getmodel())); item.add(new label("classname", item.getmodelobject().getsimplename())); } }; typeslistview.setreuseitems(true); checkgroup.add(typeslistview); form.add(checkgroup); add(form); } public list<class<?>> getsearchabletypes() { return types; }
thanks , kind regards,
merlijn
you want search server side. so, server needs know items checked in order search.
just use plain old form searchfield (including checkboxes) , make after entering search-value user posts form. way, serverside code receive search value , list of checked checkboxes , know search for.
ajaxformchoicecomponentbehaviour indeed update server side checkgroup after every click ajax post. if need know value of checkgroup after posting search value, don't use ajaxformchoicecomponentbehaviour , submit form. both normal form submit , ajax submit work here.
Comments
Post a Comment