Example of the NotifyBeginQuery, NotifyNewFieldQuerySpec, and NotifyEndQuery Notifications
The following code is an example usage of the NotifyBeginQuery, NotifyNewFieldQuerySpec, and NotifyEndQuery notifications:
// Let's see a simple example involving all the three. First we will take up the
query start.
this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_BEGIN_QUERY"),
function (){
// Query begins - The renderer will use this notification to show a bubble box having
a number of choices. This might be driven off of a dropdown in the actual applet -
we already have the choices.
this.SetProperty ("showBubble", true);
});
// Now we'll attach to Field Spec. If that dropdown has a pre default value, then
we can highlight that choice in our bubble.
this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_NEW_FIELD_QUERYSPEC"),
function (propSet){
if (propSet.GetProperty(consts.get("SWE_PROP_NOTI_FIELD") === "Customer Type"){
var value = propSet.GetProperty(consts.get("SWE_PROP_VALUE");
var bubbleValues = this.Get (bubbleValueArray);
this.SetProperty ("SetBubbleHighlightIndex", bubbleValues.indexOf(value));
}
});
// Next the obvious. The death of the bubble.
this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_END_QUERY"), function
(){
this.SetProperty ("showBubble", false);
});