ZK8 Features for MVC - Shadow Elements - Part 2"
From Documentation
Robertwenzel (talk | contribs) |
Robertwenzel (talk | contribs) |
||
Line 35: | Line 35: | ||
</source> | </source> | ||
− | * allows replacing the whole Model => | + | * allows replacing the whole Model => re-render all elements |
− | * allows adding/removing single elements => | + | * allows adding/removing single elements => re-render only affected elements |
* supported only by specific components (grid/listbox/combobox/tabbox ...) | * supported only by specific components (grid/listbox/combobox/tabbox ...) | ||
Line 50: | Line 50: | ||
</source> | </source> | ||
− | * allows replacing the whole Model => | + | * allows replacing the whole Model => re-render all elements |
− | * ( | + | * (before ZK 8) didn't update adding/removing single elements => needed to re-render all elements |
+ | * requires MVVM / BindComposer | ||
== <forEach> usages == | == <forEach> usages == |
Revision as of 07:59, 2 December 2016
Author
Robert Wenzel, Engineer, Potix Corporation
Robert Wenzel, Engineer, Potix Corporation
Date
December 2016
December 2016
Version
ZK 8.0
ZK 8.0
Introduction
In continuation of the previous article LINK ME I'll focus this time on the shadow element <forEach>.
Some background
The intention behind <forEach> are similar to those of the <apply> shadow element. Several historically evolved mechanisms to repeat UI components with their own specific behavior and limitations needed a unified abstraction to become more versatile and layout neutral (no additional DOM elements) at the same time.
Let's look at what's been there before:
<div forEach="${someCollection}">
${each.label}
<div>
- limited to static layouts at zul parse time
<listbox model="${someListModel}">
<template name="model">
<listitem label="${each.label}"/>
</template>
</listbox>
- allows replacing the whole Model => re-render all elements
- allows adding/removing single elements => re-render only affected elements
- supported only by specific components (grid/listbox/combobox/tabbox ...)
children-binding restricted to MVVM
<div children="${someListModel}">
<template name="children">
<label value="${each.label}"/>
</template>
</div>
- allows replacing the whole Model => re-render all elements
- (before ZK 8) didn't update adding/removing single elements => needed to re-render all elements
- requires MVVM / BindComposer
<forEach> usages
static usage (index, array, collection)
dynamic usage (ListModel)
Adding templates
with dynamic templates
control from java code (MVC)
Summary
Comments
Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License. |