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

Form Binding doesn't update the bean field when a binding bean changed

    Details

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

      Description

      http://screencast.com/t/Qwr4Jd93WB

      <zk>
      	<zscript><![CDATA[
      		class Item {
      			private String name;
      			
      			public Item(String name) {
      				this.name = name;
      			}
      			
      			public String getName() {
      				return name;
      			}
      		}
      		
      		class Product {
      			private Item item;
      			
      			public Product(Item item) {
      				this.item = item;
      			}
      			
      			public Item getItem() {
      				return item;
      			}
      			
      			public void setItem(Item item) {
      				this.item = item;
      			}
      		}
      		
      		class MyVM {
      			private List list;
      			private Product product;
      			
      			public MyVM() {
      				list = new ArrayList();
      				list.add(new Item("Item 1"));
      				list.add(new Item("Item 2"));
      				list.add(new Item("Item 3"));
      			}
      			
      			public List getList() {
      				return list;
      			}
      			
      			public Product getProduct() {
      				return product;
      			}
      			
      			public void setProduct(Product product) {
      				this.product = product;
      			}
      			
      		}
      	]]></zscript>
      	
      	
      	<window apply="org.zkoss.bind.BindComposer"
      		viewModel="@id('vm') @init('MyVM')">
      		<div form="@id('fx')@load(vm.product)">
      			<vlayout>
      				<div>
      					fx.item: <label value="@load(fx.item)"/>
      				</div>
      				<div>
      					fx.item.name: <label value="@load(fx.item.name)"/>
      				</div>
      			</vlayout>
      			<combobox model="@load(vm.list)"
      				selectedItem="@bind(fx.item)">
      				<template name="model" var="item">
      					<comboitem label="@load(item.name)"/>
      				</template>
      			</combobox>
      		</div>
      	</window>
      </zk>
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: