ZUML Attributes, @NotifyChange

asked 2018-03-05 09:01:56 +0800

psinalberth gravatar image psinalberth
44 4


In my viewmodel there is a collection of parent objects and for each parent there is a collection of children. I have a filter method which looks for parents by some child property e.g. name and my method has the @NotifyChange("parents") annotation. The Java code works fine, my collection is updated but not my zul. I'm using forEach directive to iterate parents and children just like that:

<div class="column" forEach="${vm.parents}">
      <div class="card">
        <div class="card-header">      
         <a sclass="navbar-item">
           <vlayout sclass="icon has-text-warning">
             <vlayout sclass="far fa-edit"></vlayout>
            <label sclass="card-header-title" value="${each.name}" />
        <div class="card-content">
          <div class="columns is-multiline">
            <div class="column is-one-quarter" forEach="${each.children}">
              <label sclass="title is-6 is-mega-menu-title" style="padding-left: 1rem" value="${each.name}"/>
              <a sclass="navbar-item is-6" forEach="${each.children}" label="${each.name}" />

My guess is: this is happening because I'm not actually binding a collection like @load(vm.parents). When I try to do that with forEach directive, it doesn't work. Is there a way to do that with MVVM approach? Update a collection, and applying it inside forEach or similar.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-05 15:18:13 +0800

chillworld gravatar image chillworld flag of Belgium
5242 3 9

${} is a static annotation, if you want notifyChange to work you need @load.
There is also the children attribute, in the article it's explained on how to use it with MVVM.


link publish delete flag offensive edit


Thanks again, Chill! That's what I've been looking for! I'm trying to do the same children binding example from the page you sent, but using simple HTML, now it seems much better with template and children directives. I wasn't sure about ${} being used to handle some static piece of code. =D

psinalberth ( 2018-03-05 23:36:06 +0800 )edit

No problem, we all have the same things to learn in the beginning

chillworld ( 2018-03-06 00:14:28 +0800 )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-03-05 09:01:56 +0800

Seen: 9 times

Last updated: Mar 05