`
fm2005
  • 浏览: 17860 次
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics