javadata-bindingzkzk-grid

Excecution create components in for each zk


I need do an excecution.createComponent in ZK in a for each

Then i need create the component in columns of a grid,

My code is:

<zk>
    <window title="MVVM window Passing arguments and retur values. This is one.zul"
        border="normal" apply="org.zkoss.bind.BindComposer"
        viewModel="@id('e') @init('Include1Composer')">
        <grid id="grid1">
            <columns>
                <column forEach="${e.list}" label="${each}" >
           <window id="${each}">
                    <zscript>  
                         Map arg = new HashMap();
                         arg.put("columnName", ${each});
                         Executions.createComponents("index_1.zul",${each} , arg);
                    </zscript>
                    <textbox value="${each}"/>
           </window>
                </column>
            </columns>

        </grid>
   </window>
</zk>

I am creating a window in each column and pass the id with ${each} to the excecution createComponents, therefore i create the component in each column, and i need too pass the value of the each to save in my java class, then i need pass the ${each} like arg, then i am trying with this code, but not works, if somebody can help me.


Solution

  • You could use a <include> tag instead of your zscript:

    <column forEach="${e.list}" label="${each}" >
      <window>
        <include src="index_1.zul" columnName="${each}" />      
        <textbox value="${each}"/>
      </window>
    </column>