Wicket Checkbox onUpdate not being called on JQuery changing check state -
i have data table i've added panel holds checkbox in cell. have panel has checkbox use select checkboxes in data table. select done jquery , jquery in code below. how can onclick or onchange event called when jquery select checkbox checked? i've tried using ajaxcheckbox below event not being called.
private static list<checkbox> checkboxes = new arraylist<checkbox>(); private static class actionspanel extends panel { public actionspanel(string id, imodel<workordercustomer> model, final string uuid ) { super( id ); ajaxcheckbox checkbox = new ajaxcheckbox("checkbox", model.of(boolean.false)) { private static final long serialversionuid = 1l; @override protected void oncomponenttag(componenttag tag) { super.oncomponenttag(tag); tag.append("class", uuid, " "); } @override protected void onupdate(ajaxrequesttarget target) { if( getmodelobject() == true ) { checkboxes.add(this); } else { checkboxes.remove(this); } } }; add( checkbox ); } } private static class activitypanel extends panel { private final string selectcheckboxjs = "if($(this).attr('checked') == 'checked') {var val=true;} else {var val=false;}$('." + uuid + "').each(function() { $(this).attr('checked', val); });" private static final long serialversionuid = 1l; @inject private dao dao; private dropdownchoice<string> activities; public activitypanel(string id, final string selectcheckboxjs, filterform form) { addactivityswitchpanel(selectcheckboxjs, form); } private void addactivityswitchpanel(final string selectcheckboxjs, filterform form) { checkbox checkall = new checkbox("checkall"); checkall.add(new changeactivitysearchbehavior() { @override public void oncomponenttag(component component, componenttag tag) { tag.put("onclick", selectcheckboxjs); } }); submitlink changeactivitylink = new submitlink("activitylink", form); add( checkall ); add( changeactivitylink ); } }
instead of changing value of checked
attribute $(this).trigger('click')
on checkboxes.
also take @ org.apache.wicket.markup.html.form.checkgroupselector
component.
Comments
Post a Comment