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

Use children in a form binding doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.2
    • 6.5.1
    • Databind 2
    • None
    • None

      If you use model bind, it works fine.

      <zk>
      	<zscript><![CDATA[
      		import java.util.Arrays;
      		import java.util.List;
      		
      		import org.zkoss.bind.annotation.Init;
      		
      		public class MyData {
      			private List list;
      	
      			
      			
      			public MyData(List list) {
      				super();
      				this.list = list;
      			}
      	
      			public List getList() {
      				return list;
      			}
      	
      			public void setList(List list) {
      				this.list = list;
      			}
      			
      		}
      		
      		public class TestVM {
      			private MyData myData;
      			
      			public MyData getMyData() {
      				if (myData == null)
      					myData = new MyData(Arrays.asList(new String[]{"A","B","C"}));
      				return myData;
      			}
      		}
      	]]></zscript>
      
      	<window apply="org.zkoss.bind.BindComposer"
      		viewModel="@id('vm') @init('TestVM')">
      		<groupbox form="@id('prn') @load(vm.myData)" >
      			<!-- 		 
      			<grid model="@load(prn.list)">
      				<columns>
      					<column label="Sprache" />
      				</columns>
      				<template name="model" var="item">
      					<row>
      						<textbox value="@bind(item)"
      							cols="2">
      						</textbox>
      					</row>
      				</template>
      			</grid>
      			-->
      			<grid>
      				<columns>
      					<column label="Sprache" />
      				</columns>
      				<rows children="@load(prn.list)">
      					<template name="children" var="item">
      						<row>
      							<textbox value="@bind(item)"
      								cols="2">
      							</textbox>
      						</row>
      					</template>
      				</rows>
      			</grid>
      		</groupbox>
      	</window>
      </zk>
      

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

              Created:
              Updated:
              Resolved: