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

Use children in a form binding doesn't work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.1
    • Fix Version/s: 6.5.2
    • Component/s: Databind 2
    • Labels:
      None

      Description

      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>
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: