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

Annotation data binding doesn't work properly with ZK 6.5.3 and later

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 7.0.1, 6.5.6
    • 6.5.3, 7.0.0, 6.5.4
    • None
    • Security Level: Jimmy
    • None
    • None

      as code below, the combobox should become enabled when clicking 'CONTACT',
      it works well with 6.5.3 but has problem including and after 6.5.4

      Furthermore, it doesn't work properly as soon as you change 'onClick' event to 'onCheck' event,
      including and after 6.5.3,
      the setter will be triggered only once, and the order is not correct.

      <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
      <zk>
          <window>
              <zscript><![CDATA[
              class SelectionModel{
                  String ticketAuthorType = "CURRENT";
                  selectedAuthorContact = null;
      
                  public String getTicketAuthorType() {
                      return ticketAuthorType;
                  }
      
                  public void setTicketAuthorType(String string) {
                  	System.out.println("setTicketAuthorType " + string);
                      ticketAuthorType = string;
                  }
      
                  public String getSelectedAuthorContact() {
                      return selectedAuthorContact;
                  }
      
                  public void setSelectedAuthorContact(String string) {
                      selectedAuthorContact = string;
                  }
      
                  public getContacts() {
                      if("CURRENT".equals(ticketAuthorType)) {
                          return new String[]{};
                      } else {
                          return new String[] {"Jean Dupont", "Jeanne Dupond"};
                      }
                  }
              }
              class MyClass {
                  SelectionModel selectionModel = new SelectionModel();
                  public SelectionModel getSelectionModel() {
                      return selectionModel;
                  }
                  public isTicketAuthorContactDisabled() {
                  	System.out.println("isTicketAuthorContactDisabled");
                  	System.out.println(selectionModel.ticketAuthorType);
                      return !"CONTACT".equals(selectionModel.ticketAuthorType);
                  }
                  public boolean getTicketAuthorContactDisabled() {
                  	System.out.println("getTicketAuthorContactDisabled");
                  	System.out.println(selectionModel.ticketAuthorType);
                      return !"CONTACT".equals(selectionModel.ticketAuthorType);
                  }
              }
              controller = new MyClass();
          ]]>
              </zscript>
              <radiogroup id="ticketAuthorTypeField" onClick='System.out.println("checked");'
                          selectedItem="@{controller.selectionModel.ticketAuthorType, save-when='self.onClick'}">
      
                  <radio label="CURRENT:"
                         value="CURRENT"/>
      
                  <radio label="CONTACT:"
                         value="CONTACT"/>
      
                  <combobox id="authorContactField" sclass="koalyexpOptionL"
                            autodrop="true" buttonVisible="false"
                            model="@{controller.selectionModel.contacts, load-after='ticketAuthorTypeField.onClick'}"
                            selectedItem="@{controller.selectionModel.selectedAuthorContact, save-when='self.onSelect', load-after='ticketAuthorTypeField.onClick'}"
                            disabled="@{controller.ticketAuthorContactDisabled, load-after='ticketAuthorTypeField.onClick'}">
                      <comboitem self="@{each=contact}" label="@{contact}"/>
                  </combobox>
      
              </radiogroup>
          </window>
      </zk>
      

            noahhuang noahhuang
            benbai benbai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: