0

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

Comments

That worked perfectly. Thanks!

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

1 Answer

Sort by ยป oldest newest most voted
0

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

cor3000 gravatar image cor3000
6280 2 7

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)">
    <rows>
        <template name="date">
            <row>
                <datebox></datebox>
            </row>
        </template>
        <template name="text">
            <row>
                <textbox></textbox>
            </row>
        </template>
    </rows>
</grid>
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

Follow
1 follower

RSS

Stats

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