0

Updating children of collection using ViewModel

asked 2013-05-14 06:14:53 +0800

JustinFrost gravatar image JustinFrost
145 1 6

Hi all,

I am try to set up two listboxes for drag and drop. The problem is the left hand side of this is tabbox (accordion) of listboxes. The only thing a cannot get to work is the updating of the listboxes in the tabbox. My zul code is as follows:

<tabbox mold="accordion">
<tabs children="@load(vm.topLevelNav)">
    <template name="children" var="topLevel">
        <tab label="@load(topLevel.name)"/>
    </template> 
</tabs>
<tabpanels children="@load(vm.topLevelNav)">
    <template name="children" var="parent">
        <tabpanel>
            <listbox model="@bind(parent.children)" droppable="true">
                <template name="model" var="navItem">
                    <authListItem draggable="true" navItem="@bind(navItem)"> 
                        <listcell label="@bind(navItem.name)"/>
                    </authListItem> 
                </template> 
            </listbox>
        </tabpanel>
    </template>
</tabpanels>

</tabbox>

The problem is when I modify the children of an object in the topLevelNav collection, the listbox does not refresh. How do I make this happen ?

It is like I need the listbox inside the tab panel to have another View Model.

Any help here would be great, been stuck on this for a while.

Thanks.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-05-15 03:45:28 +0800

JustinFrost gravatar image JustinFrost
145 1 6

I found the solution to this one. I mis-understood how the notifyChange annotation worked. In the end I needed to implicitly update the children property in my ViewModel when a change was made:

BindUtils.postNotifyChange(null,null,this,"children");
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
1 follower

RSS

Stats

Asked: 2013-05-14 06:14:53 +0800

Seen: 18 times

Last updated: May 15 '13

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