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

adding components in @AfterCompose fails binding initialization

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: Freshly, 8.0.5, 8.5.0
    • Fix Version/s: 8.5.1
    • Component/s: Databind 2
    • Security Level: Jimmy
    • Environment:

      this problem happens when using ZK EE
      in ZK CE the bindings are initialized as expected

    • gh.sprint.customfield.default.name:
      ZK 8.5.1 R1

      Description

      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.

        Issue Links

          Activity

          Hide
          JamesChu JamesChu added a comment -

          Fixed since 2018/01/19

          Show
          JamesChu JamesChu added a comment - Fixed since 2018/01/19

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                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

                  Agile