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

The selected Objects of the Chosenbox is empty when using a model with java bean data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Normal Normal
    • 6.5.5
    • 6.5.4
    • Components
    • None

      <zk>
      	<zscript><![CDATA[
      		public class Item {
      			private String name;
      		
      			public Item(String name) {
      				super();
      				this.name = name;
      			}
      		
      			public String getName() {
      				return name;
      			}
      		
      			public void setName(String name) {
      				this.name = name;
      			}
      		
      			public int hashCode() {
      				final int prime = 31;
      				int result = 1;
      				result = prime * result + ((name == null) ? 0 : name.hashCode());
      				return result;
      			}
      		
      			public boolean equals(Object obj) {
      				if (this == obj)
      					return true;
      				if (obj == null)
      					return false;
      				if (getClass() != obj.getClass())
      					return false;
      				Item other = (Item) obj;
      				if (name == null) {
      					if (other.name != null)
      						return false;
      				} else if (!name.equals(other.name))
      					return false;
      				return true;
      			}
      		}
              
              int i = 0;
              List list = Arrays.asList(new Item[]{
              		new Item("AA"), new Item("BB"), new Item("CC"), new Item("DD"), new Item("EE")});
              ListModelList model = new ListModelList(list);
          ]]></zscript>
          <chosenbox id="box" width="200px" model="${model}" >
          	<template name="model">
          		<label value="${each.name}"/>
          	</template>
          </chosenbox>
          <button label="model replace">
          	<attribute name="onClick"><![CDATA[
      			alert(box.getSelectedObjects());
          	]]></attribute>
          </button>
      </zk>
      

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

              Created:
              Updated:
              Resolved: