Declaring an Important Event

From Documentation


Declaring an Important Event



The third argument of addClientEvent is used to declare an event as import. The argument is a combination of integer flags that indicate how to handle the event. The CE_IMPORTANT flag is used to indicate that this event is very important and should be sent to the server even if there is no server side listener registered for the event. For other flags such as CE_NON_DEFERRABLE (send immediately) or CE_REPEAT_IGNORE please refer to the Java API: ComponentCtrl.

For example, we require the onClear event to be sent to the server at all times so we are required to declare the following:

static {
		addClientEvent(SimpleLabel.class, ClearEvent.NAME, CE_IMPORTANT);
	}

Now the ClearEvent is guaranteed to be sent to the server which solves our syncing problem. We have a simple label with some additional features which works as advertised. This label has served as a good introduction to component development with ZK.



Last Update : 2014/10/15

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.