-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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>
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)"/>
</forEach>
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)"/>
</template>
</div>
Robert
Asked: 2017-09-13 00:02:43 +0800
Seen: 7 times
Last updated: Sep 13 '17