0

在ZUL檔裡如何去儲存forEach裡的物件呢?

asked 2007-06-05 21:14:46 +0800

tommy1973 gravatar image tommy1973
3 2
以下是我的範例:
<window title="Livedata Demo" border="normal">
<zscript>
String[] data = new String[30];
for(int j=0; j < data.length; ++j) {
data[j] = "option "+j;
}
</zscript>
<listbox id="list" width="200px" rows="10" >
<listhead>
<listheader label="Load on Demend" sort="auto"/>
</listhead>
<listitem forEach="${data}">
<listcell label="${each}"/> // 在這邊我要如何去關聯一個listcell就有一個原本的each的物件呢?
</listitem>
</listbox>
</window>
delete flag offensive retag edit

1 Reply

Sort by » oldest newest

answered 2007-06-05 23:26:39 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team
你可以用 "custom-attributes" 去定義你自己的動態attribute。

例如:
<window title="Livedata Demo" border="normal">
<zscript>
String[] data = new String[30];
for(int j=0; j < data.length; ++j) {
data[j] = "option "+j;
}
</zscript>
<listbox id="list" width="200px" rows="10" >
<listhead>
<listheader label="Load on Demend" sort="auto"/>
</listhead>
<listitem forEach="${data}">
<listcell id="listcell${forEachStatus.index}" label="${each}">
<custom-attributes var="${each}"/> // 這邊使用
</listcell>
</listitem>
</listbox>
<zscript>
alert(listcell0.getAttribute("var")); //取出的方式
</zscript>
</window>

PS:你可以參考一下ZK-devguide手冊(The custom-attributes element)。

/Jumper
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: 2007-06-05 21:14:46 +0800

Seen: 1,357 times

Last updated: Jun 05 '07

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