Reputation: 1909
TL;DR How to temporarily disable a View so I can safely load another View, then safely close the loaded View to return to the original View?
I have the following scenario:
/search
which loads SearchView
. SearchView
is filled with data, UI is updated to reflect that.SearchView
is disabled (only need to disable events
?).ItemView
is loaded, displaying the item detail.ItemView
.SearchView
is re-enabled.What is the best way to achieve point 5 and 8? I'm thinking of calling SearchView.unbind()
(for point 5) and SearchView.bind()
(for point 8).
Bonus: It would be better if the solution is stack-like. I.e. View A loads View B which can load View C. When View C is closed, View B is reinstated, etc.
Upvotes: 5
Views: 4169
Reputation: 18597
Try calling SearchView.undelegateEvents()
for point 5, and then SearchView.delegateEvents()
for point 8.
Upvotes: 9