开发者

zk combobox databinding

开发者 https://www.devze.com 2022-12-29 09:17 出处:网络
The zk code below only shows on item... I need it to show all elements in tmp. any idea? thanks <zscript>

The zk code below only shows on item...

I need it to show all elements in tmp. any idea? thanks

<zscript>
    <![CDATA[
        List tmp=Arrays.asList(new String[]{"a","b","c"});
    ]]>
</zscript>

<combobox id=&quot;mycb&qu开发者_如何转开发ot; model="@{tmp}">
    <comboitem self="@{each=row}" label="xxx" value="yyy">
    </comboitem>
</combobox>


You need to initialize the databinder in your ZUL file. In addition there is no need to wrap your array as a List (you can if you want to). The following code works:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> 
<zk>
  <zscript>
      <![CDATA[
          String[] data = new String[]{"a","b","c"};
      ]]>
  </zscript>
  <combobox id="list" width="200px" model="@{data}"/> 
</zk>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号