0

Grid model with components

asked 2022-03-18 22:51:07 +0800

aUser gravatar image aUser
137 1 4

Hello,

I have a list of rows that I would like to display in a zul page.

....
List<Row> rows = new ArrayList<>();

@Init
public void init() {
    Row row = new Row();
    Label label = new Label();
    label.setValue("description1");
    row.appendChild(label);
    Textbox text = new Textbox();
    text.setValue("static textbox");
    row.appendChild(text);
    rows.add(row);
}
....
public List<Row> getRows() {
    return rows;
}

In the zul page I tried this but it doesn't work:

...
<grid model="@load(vm.rows)">
    <columns>
        <column label="column1" />
        <column label="column2" />
    </columns>
    <rows>
        <template name="model">
            @load(each)
        </template>
   </rows>
</grid>

From this grid tutorial it shows something similar but it uses EL expression and as far as I know this is loaded only once and it cannot change its content, that's not what I need because the list of these rows can change at runtime through a button for example.

I created this fiddle with the above test.

What is the simplest way to do something like this? Thank you

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-03-19 00:15:37 +0800

aUser gravatar image aUser
137 1 4

I found a solution, hope this helps

Fiddle example

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

RSS

Stats

Asked: 2022-03-18 22:51:07 +0800

Seen: 3 times

Last updated: Mar 19

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