-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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)
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 GroupsDataEvent
s 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
Asked: 2017-07-19 05:24:20 +0800
Seen: 17 times
Last updated: Jul 20 '17