Render arraylist items vertically

asked 2017-09-13 00:02:43 +0800

ajamardo gravatar image ajamardo
21 3

I am building a message system (something really similar to a mailbox), and I will allow the users to attach files.

When they attach a file, it will show a small file icon in the down part, but I want them to be able to attach several files, and I'd like all the icons, one per file horizontally aligned in the same hlayout.

I've been trying to use listbox and grid to do that, but per item, it sets them vertically, so, I don't know how to do that... thanks in advance.

Last code I tested (witht the file names instead the icon, but still the same problem)

<hlayout hflex="1"> <grid hflex="1" vflex="1" model="@load(vmApp.messageInput.files)"> <template name="model" var="tObj"> <label value="@load(tObj.file.title)"/> </template> </grid> </hlayout>

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-13 11:31:02 +0800

cor3000 gravatar image cor3000
3967 1 7
ZK Team

updated 2017-09-13 11:33:28 +0800

Grid and Listbox produce a table layout with a for each item/row. So they are not the suitable component for that. Since ZK 8 (EE) the shadow elements (esp. <foreach>) were added that allow leveraging a list model with any kind of component.

<forEach items="@load(vmApp.messageInput.files)" var="tObj">
  <label value="@init(tObj.file.title)"/>

You can try them out using the EE-Eval version 8.0.5-Eval (don't forget to add the zuti jar/artifact to your dependencies).

With ZK CE you can use MVVM children binding which allows a similar thing

<div children="@load(vmApp.messageInput.files)">
  <template name="children" var="tObj">
    <label value="@init(tObj.file.title)"/>


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: 2017-09-13 00:02:43 +0800

Seen: 7 times

Last updated: Sep 13 '17

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