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 Model<String>("-"));
                else
                        invokingButton.setLabel(new Model<String>("+"));
                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 Model<String>("+"))
                     .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-response><component
id="expandableWhenReject4c" ></component><component id="btnExpander47"
></component><header-contribution encoding="wicket1"
></header-contribution><evaluate></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
Model<ShareActivityPlusDecode>((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

Reply via email to