-
Bug
-
Resolution: Fixed
-
Normal
-
6.5.4
-
Windows 7, JDK 7, Tomcat 7
since commit 881f5f1ce0a0fbc15bd0c71e801faf0ceed3027f (fix zk 1887...) and a87c0e0c3b5eb479908914adef227e2e4174e417 (refix/finetune fix of 1877), when removing a child component and then appending it, binding is not initialized.
In the following example if "Button 1" is clicked after "Remove & Append", no notification will be shown.
<zk> <div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('test.TestVM')"> <button label="Remove & Append" onClick="@command('doRemoveAppend')" /> <div id="container"> <button id="btn1" label="Button 1" onClick="@command('doNotify',msg=self.label,type='info',ref=self,position='at_pointer',duration=1000)" /> </div> </div> </zk>
public class TestVM { @Wire("#container") private Div container; @AfterCompose public void afterCompose(@ContextParam(ContextType.VIEW) Component view) { Selectors.wireComponents(view, this, false); } @Command public void doRemoveAppend() { Component c = container.getChildren().get(0); container.removeChild(c); container.appendChild(c); } @Command public void doNotify(@BindingParam("msg") String msg, @BindingParam("type") String type, @BindingParam("ref") Component ref, @BindingParam("position") String position, @BindingParam("duration") Integer duration) { Clients.showNotification(msg, type, ref, position, duration); } }
- relates to
-
ZK-1887 detach - reattach component in ViewModel @AfterCompose, fails to initialize bindings
- Closed