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

Databinding 1 cannot clear selection item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.3
    • 6.5.2
    • Databind
    • Security Level: Jimmy
    • None
    • None

      <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
      <zk>
      	<window>
      		<zscript><![CDATA[
      			
      			class Data {
      				private List list;
      				private String selItem;
      				
      				public Data() {
      					list = new ArrayList();
      					list.add("Item 1");
      					list.add("Item 2");
      					list.add("Item 3");
      				}
      				
      				public List getList() {
      					return list;
      				}
      				
      				public String getSelItem() {
      					return selItem;
      				}
      				public void setSelItem(String selItem) {
      					this.selItem =  selItem;
      				}
      				
      				
      			}
      			
      			Data data = new Data();
      			
      		]]></zscript>
      		
      		<listbox width="150px" model="@{data.list}" selectedItem="@{data.selItem}">
      			<listitem label="@{each}"/>
      		</listbox>
      		<button label="1. set selected item">
      			<attribute name="onClick"><![CDATA[
      				data.setSelItem("Item 1");
      				binder.loadAll();
      			]]></attribute>
      		</button>
      		<button label="2. clear selected item">
      			<attribute name="onClick"><![CDATA[
      				data.setSelItem(null);
      				binder.loadAll();
      			]]></attribute>
      		</button>
      	</window>
      </zk>
      

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

              Created:
              Updated:
              Resolved: