I am using GWTBootstrap3 Typeahead widget. The main problem is the event is not getting deregistered and the events are bundling up as many times i load the component. The components are cached by default. The first component load triggers event 1 time and in second time component load triggers 2 times and so on. It's causing a lot of problem. I have tried HandlerRegistration and removeHandler() its not working. If any body found a solution please let me know.
Here is the bit of code where the event is registered:
HandlerRegistration typeAheadListener =
productSelect.addTypeaheadSelectedHandler(new TypeaheadSelectedHandler<Part>() {
@Override public void onSelected(TypeaheadSelectedEvent<Part> event) {
selectedPart = event.getSuggestion().getData(); // Handling the event
}
});
Thanks
I can think of two options there:
You can register the event handler in the productSelect's constructor, or in the code where you call the constructor. Not when the component is loaded.
You can check the HandlerRegistration API, it gives a tip on how a handler can deregister itself: