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

listbox data is not loaded when rod is enable in zkbind

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 5.0.10
    • 5.0.9
    • None
    • None

      In following example, if the rod is enabled. the listbox get wrong result. (no such issue in grid or disable listbox rod)
      1. load the page, you will see A0 loaded in both listbox and grid.
      2. click reload (perform zkbind reload the model), you will see listbox become empty
      3. click the invalidate (perform zk component invalidate), the data of listbox is back.

      I did some code trace, the data has loaded to the label in step 2. in server side , but not showing in the client
      so when click on step 3. the data will back which prove that data was loaded. in step 2.

      	<library-property>
      		<name>org.zkoss.zul.listbox.rod</name>
      		<value>true</value>
      	</library-property>
      	<library-property>
      		<name>org.zkoss.zul.grid.rod</name>
      		<value>true</value>
      	</library-property>
      
      <window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('org.zkoss.zktest.bind.issue.B00714')">
      	<listbox id="outerbox" width="300px" model="@bind(vm.items)" rows="5">
      		<template name="model" var="item" status="s">
      			<listitem>
      				<listcell >
      					<label value="@bind(item.name)"/>
      				</listcell>
      			</listitem>
      		</template>
      	</listbox>
      	<grid id="outergrid" width="300px" model="@bind(vm.items)" height="200px" >
      		<template name="model" var="item" status="s">
      			<row>
      				<label value="@bind(item.name)"/>			
      			</row>
      		</template>
      	</grid>	
      	<hbox>
      		<button label="reload" onClick="@command('reload')" />
      		<button label="invalidate" onClick="outerbox.invalidate()" />
      		<button label="Dump" onClick="binder.getTracker().dump()" />
      	</hbox>	
      </window>
      
      public class B00714 {
      	private String message1;
      
      	List<Item> items = new ArrayList<Item>();
      	
      	Item selected;
      
      	public B00714() {
      		items = new ListModelList<Item>();
      		for(int i=0;i<1;i++){
      			items.add(new Item("A"+i));
      		}
      	}
      
      	public List<Item> getItems() {
      		return items;
      	}
      
      	static public class Item {
      		String name;
      
      		public Item(String name) {
      			this.name = name;
      		}
      
      		public String getName() {
      			return name;
      		}
      
      		public void setName(String name) {
      			this.name = name;
      		}
      
      	}
      
      	@NotifyChange("items") @Command
      	public void reload() {
      		
      	}
      
      }
      

            SimonPai SimonPai
            dennis dennis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: