zk 3.6数据绑定

官网提供了listbox的数据绑定,测试了下相当不错,再试试grid绑定和自动排序。

zul页面

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<window id="win" use="com.udooo.window.BookWindow" title="ZK Tutorial" width="1024px" border="normal">
    <listbox model="@{win.books}">
        <listhead sizable="true">
            <listheader label="名称" width="100px" sort="auto(name)" />
            <listheader label="作者" width="250px" sort="auto(author)" />
            <listheader label="出版社" width="250px" sort="auto(pub)" />
            <listheader label="价格" width="250px" sort="auto(price)" />
        </listhead>
        <listitem self="@{each=book}">
            <listcell label="@{book.name}" />
            <listcell label="@{book.author}" />
            <listcell label="@{book.pub}" />
            <listcell label="@{book.price}" />
        </listitem>
    </listbox>
    <space/>
    <grid model="@{win.books}" rowRenderer="com.udooo.renderer.BookRenderer">
        <columns menupopup="auto">
            <column label="名称" sort="auto(name)"/>
            <column label="作者"/>
            <column label="出版社"/>
            <column label="价格"/>
        </columns>
    </grid>
</window>

grid要绑定数据关键是要指定Rowrenderer就好了。

参考文章:

http://en.wikibooks.org/wiki/ZK/How-Tos/Data-Binding

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值