0

How can i notify single record in GroupModel when deleting the record?

asked 2017-07-19 05:24:20 +0800

mallesh58 gravatar image mallesh58
1

I had a GroupModel implemented from AbstractGroupsModel and GroupsSortableModel with a Listbox in ZUL file loading it. The ViewModel consists of object for GroupModel which is now available for ZUL file.

My exact Problem: I had deleted a record from GroupModel and can be able to notify it. The problem arises when the list is large. because since it is taking too much time to load the complete list after deleting. I had decided to reload the component or Group of Component being deleted from GroupModel.

Apart from this, I've seen the GroupModel getter methods are invoked internally from ZUL page to get the details. how can we intercept them and tell the ZUL file to take the updated content. If there is any other way, Please suggest.

These are the getter methods that are called in GroupModel from ZUL file.

public T getChild(int groupIndex, int index) 
public int getChildCount(int groupIndex) 
public Object getGroup(int groupIndex) 
public int getGroupCount() 
public String getGroupName(int groupIndex)
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-20 04:19:06 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2017-07-20 04:22:45 +0800

ZK will call those methods when it "knows" about updates in the groups model to get the updated groups or group contents. To notify ZK about a change you have to call the AbstractGroupsModel#fireEvent() method to fire a GroupsDataEvent.

The Listbox will listen to these GroupsDataEvents in order to update as little as possible e.g. as in your case when only a single item is removed.

fireEvent(GroupsDataEvent.INTERVAL_REMOVED, groupIndex, itemIndexInGroup, itemIndexInGroup);

Since it's rarely used I don't know exactly if the item index is inclusive so you might have to add +1 to the interval end index.

fireEvent(GroupsDataEvent.INTERVAL_REMOVED, groupIndex, itemIndexInGroup, itemIndexInGroup + 1);

Robert

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: 2017-07-19 05:24:20 +0800

Seen: 17 times

Last updated: Jul 20 '17

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