0

Data Binding with Object inside an Object

asked 2011-11-15 05:11:03 +0800

adarshcu gravatar image adarshcu
87

Hi All,

I'm using ZK 5.0 . I have been using Data binding feature with the latest version of ZK with a simple object as of now. Suppose my POJO has one more Java Object inside that object. Then, how do we show the value of the attributes of that Object. Eg : Task object has a selectedTaskType of TaskType object as an attribute. Here how do i show the value present inside TaskType Objects.

Is this possible ?

<listbox id="dataBox" width="700px">

 		<listhead>
            <listheader label="Task ID" width="100px"/>
            <listheader label="Date Of Task" width="100px"/>
            <listheader label="Task Desc" width="200px"/>
            <listheader label="Task Type ID" width="100px"/>
            <listheader label="Task Type Name" width="100px"/>
            <listheader label="Total Effort" width="100px"/>
        </listhead>       
        <listitem self="@{each='Task'}" value="@{Task}">            
            <listcell label="@{Task.taskId}" />
            <listcell label="@{Task.DateOfTask}" />
            <listcell label="@{Task.TaskDescription}" />
            <listcell label="@{Task.SelectedTaskType.TaskTypeID}" />
            <listcell label="@{Task.SelectedTaskType.TaskTypeName}" />
            <listcell label="@{Task.TotalEffort}" />
        </listitem>
</listbox>

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-11-15 07:54:50 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6
http://www.hybris.com/

sure thing: the only requirement is to expose your instance of TaskType with a proper getter method in Task.

link publish delete flag offensive edit

answered 2011-11-15 09:11:25 +0800

adarshcu gravatar image adarshcu
87

Got the desired result. I made a mistake of using instance variable name Task.SelectedTaskType.TaskTypeID. Replaced this with Task.TaskType.TaskTypeID and it worked quite well.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2011-11-15 05:11:03 +0800

Seen: 108 times

Last updated: Nov 15 '11

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