Rowrenderer Databinding

asked 2013-05-07 17:42:18 +0800

mhlic gravatar image mhlic
38 3

I have a complex zul file with one section containing a grid (could use a listbox) that displays data from a set. I would use a template with databinding, but I want to change the element type for each row to be a textbox or a datebox based on the type of data. I see that a rowrenderer can do exactly what I want for changing the element type, but I also need databinding so that I can easily save off the changed data. What is the best way to accomplish this? In case it matters, I am using zk6.

delete flag offensive retag edit


That worked perfectly. Thanks!

mhlic ( 2013-05-14 21:29:11 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-08 11:44:48 +0800

cor3000 gravatar image cor3000
6094 2 7
ZK Team

updated 2013-05-09 02:07:58 +0800

You can achieve that in a <grid> or <listbox> using model and Dynamic Template. Define a template with <textbox>, and another one with a <datebox>, and switch the template name according to the type of each element in the listModel.

This example will switch the content according to the value in the type attribute of each element

<grid model="@load(vm.listModel) @template(each.type)">
        <template name="date">
        <template name="text">
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-05-07 17:42:18 +0800

Seen: 28 times

Last updated: May 14 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More