Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3765

adding components in @AfterCompose fails binding initialization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.1
    • Freshly, 8.0.5, 8.5.0
    • Databind 2
    • Security Level: Jimmy
    • this problem happens when using ZK EE
      in ZK CE the bindings are initialized as expected

    • ZK 8.5.1 R1

      Steps to Reproduce

      the error can be reproduced with this ZK fiddle

      click the buttons

      Current Result

      Label1 triggers a command in the VM
      Label2 does not trigger a command
      (changing the visibility flag in the VM also has no effect on the button visibility)

      Expected Result

      The command and property bindings on both buttons should initialize command and property bindings

      Debug Info

      This only happens with ZK EE (works in CE) since ZK 8.0.0 EE
      (in 7 the dynamically added button doesn't even appear)

      Workaround

      delay the component creation e.g. by posting an event
      (commented out in the fiddle example)

      		component.addEventListener("onAppendLater", new EventListener() {
                      	public void onEvent(Event e) {
      				Executions.createComponents("button2.zul", div1, null);
                              }
      		});
      		Events.postEvent("onAppendLater", component, null);
      

      Recommended Usage

      Don't mix MVVM and MVC pattern. Instead use shadow elements <if>, <apply> and <forEach> to control dynamic component creation.

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 7 hours Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - 7 hours Remaining Estimate - 1 hour
                7h