0

live data update in cached ListModel

asked 2019-01-14 10:51:28 +0800

superium gravatar image superium
17 2

I'm using a ListModel with cached Map like this : http://books.zkoss.org/zk-mvvm-book/8.0/advanced/displaying_huge_amount_of_data.html# (http://books.zkoss.org/zk-mvvm-book/8.0/advanced/displayinghugeamountofdata.html#)

paging ok. but i don't know how to add date lively.

the data was stored in a hashMap (because with paging, user may query any page ,we load it on-demand). but the traditional ListModelList (which could update data lively),use _list to store data. so I can't make it support live date update by implements ListModelList. if override the add method like this:

public boolean add(PrShowBean p) {

    ...
    boolean ret = cache.put(indexkey,data) != null;
    fireEvent(ListDataEvent.INTERVAL_ADDED, indexkey, indexkey);
    size++; 
    return ret;

}

the added data not appear in the list,but the first item in second page appears twice.

is there any way to support both load on-demand (paging) and live update ?

delete flag offensive retag edit

Comments

you can also do real time databae pagination, in mine oppinion a better way then caching some results with lesser chance of having object states not in sync with DB

chillworld ( 2019-01-15 17:57:27 +0800 )edit
Be the first one to answer this question!
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

RSS

Stats

Asked: 2019-01-14 10:51:28 +0800

Seen: 4 times

Last updated: 2 days ago

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