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

Databinding 1 cannot clear selection item

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.2
    • Fix Version/s: 6.5.3
    • Component/s: Databind
    • Security Level: Jimmy
    • Labels:
      None

      Description

      <?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>
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: