data binding with grid or listbox

asked 2018-10-18 16:48:54 +0800

n1046728 gravatar image n1046728

updated 2018-10-23 11:45:27 +0800

cor3000 gravatar image cor3000
5262 2 7
ZK Team

I have a list<fund> and in fund object has a list<stock>. I would like to show in zul as follow . I don't know how to setting tempalte tag ,appreciate for your help.

fundname stockname stockprice
A fund    XXX       20
A fund    YYY       30
C fund    xxx       40
C fund    yyy       50
delete flag offensive retag edit


there are several ways to do so, some are using ZK EE features and some are version specific ... so which version and edition are you using? (just to provide useful help in then end)

cor3000 ( 2018-10-23 11:50:21 +0800 )edit

I'm using zk 8.0 . Thanks for your help.

n1046728 ( 2018-10-25 14:49:13 +0800 )edit

CE (community) or EE (enterprise)?

cor3000 ( 2018-10-25 18:46:17 +0800 )edit


n1046728 ( 2018-10-26 17:41:21 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-10-26 19:12:23 +0800

cor3000 gravatar image cor3000
5262 2 7
ZK Team

thanks for the clarifications:

then the easiest will be to create a row object that contains a flattened view of the data. This will make the template trivial.

public class FundStockRow {
    private Fund fund;
    private Stock stock;

You then simply populate a flat ListModelList<FundStockRow>:

grid.setModel(new ListModelList<FundStockRow>(buildFlatFundStockRows(funds)));

and the template can look like this:

  <template name="model">
      <label value="${each.fund.name}"/>
      <label value="${each.stock.name}"/>
      <label value="${each.stock.price}"/>
link publish delete flag offensive edit

answered 2018-10-30 16:37:03 +0800

n1046728 gravatar image n1046728

Thank you for your help.

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




Asked: 2018-10-18 16:48:54 +0800

Seen: 12 times

Last updated: Oct 30 '18

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