0

NotifyChange on partial collection

asked 2019-04-30 12:58:11 +0800

JustinFrost gravatar image JustinFrost
145 1 6

updated 2019-05-01 15:23:02 +0800

Is there any way when notifying on a collection to only render new objects on the page ?

I have a template setup as follows:

<div children="@bind(vm.questions) @template('questionsTemplate')">
    <template name="questionsTemplate" var="question">

         </template>
</div>

We are using scrolling to load more records - when we load the second set of records we add them to the questions collection and notify in the View Model :

BindUtils.postNotifyChange(null, null, this, "questions");

This re-renders all of the questions in the collection even though some are unchanged, is there any way of avoiding this ?

Thanks.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-30 18:38:05 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

implement vm.questions with ListModel, then it will automatically notify a partial changes for you without using @NotifyChange. Please refer to https://www.zkoss.org/wiki/SmallTalks/2016/March/ZKDosandDonts#NotifyingthewholeListModelon_change

link publish delete flag offensive edit

Comments

Thanks Hawk. Does this only work with a ListBox ? We are not using a ListBox to render our data currently - we are using a custom component inside a children template.

JustinFrost ( 2019-05-01 15:36:44 +0800 )edit

@Hawk - scratch that question. It is supported in ZK8 - excellent. For others there is some information here : https://blog.zkoss.org/2015/02/25/zk8-more-powerful-data-binding-in-mvvm-chilldren-binding-support-listmodel/

JustinFrost ( 2019-05-01 15:58:33 +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

Follow
1 follower

RSS

Stats

Asked: 2019-04-30 12:58:11 +0800

Seen: 10 times

Last updated: May 01 '19

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