ajax event not quite working as planned
I have a listview where each row has an expandable section in it to show additonal detail on some rows. That works. But two aspects aren't working. 1) I am trying to change the + on the button to a -, and then back again when we collapse. My code looks like: if(invokingButton.getLabel().getObject().equals(+)) invokingButton.setLabel(new ModelString(-)); else invokingButton.setLabel(new ModelString(+)); target.add(invokingButton); The label never changes. From stepping in, I can say that yes, the label set to - line does run when expected. yes, outputmarkupId is set to true. Button code when created: item.add(new AjaxButton(btnExpander){ private static final long serialVersionUID = 1L; public void onSubmit(AjaxRequestTarget target, Form form) { onActivityLogExpansion(target, this, activity); } }.setLabel(new ModelString(+)) .setOutputMarkupId(true).setVisible(showReject || showSubmit) .setOutputMarkupPlaceholderTag(true)); 2) When I go to collapse the row, the event gets to the server, things seem to work stepping through the code, but then the region does not collapse and I get the following in the wicket ajax debug: INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=expandableWhenReject4c /componentcomponent id=btnExpander47 /componentheader-contribution encoding=wicket1 /header-contributionevaluate/evaluate/ajax-response ERROR: Wicket.Ajax.Call.processComponent: Component with id [[expandableWhenReject4c]] was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update. INFO: Response processed successfully. INFO: refocus last focused component not needed/allowed INFO: focus set on wicketDebugLink INFO: focus removed from wicketDebugLink The container being hidden is created as: WebMarkupContainer expandableReject = new WebMarkupContainer(expandableWhenReject, new ModelShareActivityPlusDecode((ShareActivityPlusDecode) item.getDefaultModel().getObject())); expandableReject.setVisible(false); expandableReject.setOutputMarkupId(true); expandableReject.setOutputMarkupPlaceholderTag(true); and in the event: WebMarkupContainer wmc = (WebMarkupContainer) invokingButton.getParent().get(expandableWhenReject); wmc.setVisible(!wmc.isVisible()); target.add(wmc); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-event-not-quite-working-as-planned-tp4665083.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ajax event not quite working as planned
Hi, See ListView#setReuseItems() javadoc Martin Grigorov Wicket Training and Consulting On Sun, Mar 23, 2014 at 7:26 PM, Entropy blmulholl...@gmail.com wrote: I have a listview where each row has an expandable section in it to show additonal detail on some rows. That works. But two aspects aren't working. 1) I am trying to change the + on the button to a -, and then back again when we collapse. My code looks like: if(invokingButton.getLabel().getObject().equals(+)) invokingButton.setLabel(new ModelString(-)); else invokingButton.setLabel(new ModelString(+)); target.add(invokingButton); The label never changes. From stepping in, I can say that yes, the label set to - line does run when expected. yes, outputmarkupId is set to true. Button code when created: item.add(new AjaxButton(btnExpander){ private static final long serialVersionUID = 1L; public void onSubmit(AjaxRequestTarget target, Form form) { onActivityLogExpansion(target, this, activity); } }.setLabel(new ModelString(+)) .setOutputMarkupId(true).setVisible(showReject || showSubmit) .setOutputMarkupPlaceholderTag(true)); 2) When I go to collapse the row, the event gets to the server, things seem to work stepping through the code, but then the region does not collapse and I get the following in the wicket ajax debug: INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=expandableWhenReject4c /componentcomponent id=btnExpander47 /componentheader-contribution encoding=wicket1 /header-contributionevaluate/evaluate/ajax-response ERROR: Wicket.Ajax.Call.processComponent: Component with id [[expandableWhenReject4c]] was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update. INFO: Response processed successfully. INFO: refocus last focused component not needed/allowed INFO: focus set on wicketDebugLink INFO: focus removed from wicketDebugLink The container being hidden is created as: WebMarkupContainer expandableReject = new WebMarkupContainer(expandableWhenReject, new ModelShareActivityPlusDecode((ShareActivityPlusDecode) item.getDefaultModel().getObject())); expandableReject.setVisible(false); expandableReject.setOutputMarkupId(true); expandableReject.setOutputMarkupPlaceholderTag(true); and in the event: WebMarkupContainer wmc = (WebMarkupContainer) invokingButton.getParent().get(expandableWhenReject); wmc.setVisible(!wmc.isVisible()); target.add(wmc); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-event-not-quite-working-as-planned-tp4665083.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ajax event not quite working as planned
Setting that AND adding the form that contains the list to the target (which was inspired by that bit of text) seems to have solved issue #2, the collapse. Thanks! However, issue #1, the button label, is still not working correctly. Any insight there? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-event-not-quite-working-as-planned-tp4665083p4665085.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
JavaLand 2014
Hi, anyone at the JavaLand 2014 conference in Brühl this week? I'd be happy to meet, ping me on twitter: @funkattack or send an E-Mail: mafulaf...@gmail.com Cheers, Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org