Hybrid View
-
24 Sep 2012 10:31 PM #1
Ext.Animator.runningAnimationsData does not clear after animation finished
Ext.Animator.runningAnimationsData does not clear after animation finished
I have encountered some strange behavour with animation. May be it's my mistake, but I would like to describe the case.
I have MVC app, where we support views and card layout. One view - is login page and I have login and lgout procedure. Our transition is slide. Everything works fine. But I found one case:
1) after login and running the app I make logout at any time, which makes these steps
- destroy all views and controllers:
- redirect to Login PageCode:view.destroy(); delete Ext.app.Application.getControllerInstances()[controllerName]; delete Ext.app.Application.controllers[controllerName];
At the moment of logout I have only one view, because I destroy view every time after switching to another.Code:Ext.Viewport.setActiveItem(loginPageViewInstance);
2) I enter my app for the second time, and everyting is fine, but when I try to open view, which was the last showed in a previous session before logout, this view has got visibility: "hidden !important" style and I see only blank page with my invisible view.
I found, why is it happened. Every time I switch between views I run Ext.Animator's CSS transition for animation. It log every animation in Ext.Animator.runningAnimationsData array, where in my case I have two animation sessions for previous hiding view and next showing view at one transition operation.
When I make logout and invoke view.destroy as a child of Ext.Viewport it makes parent.remove(view), i.e. Ext.Viewport.remove(view). Which starts animation operation over my last view, and unfortunately it leaves info of last view in Ext.Animator.runningAnimationsData like animation did not finished. As a result after logout and second view showing Ext.Animator thinks that this view is visible (because of this info) and doesn't remove visibility: hidden from it's style.
I make this hack code:
but it's not good to use private code. I would be happy to receive someone's advice or make it clear, what is wrong.Code:delete Ext.Animator.runningAnimationsData[view.id];
-
27 Sep 2012 6:21 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
Why are you trying to delete a controller? You shouldn't do this.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Sep 2012 7:15 AM #3
I destroy view to release free resources. When it happened event listeners are removed too. And controller looses reference to view's DOM, it becomes useless. So when we create view again there are no listeners and we need to recreate it's controller to renovate listeners.
-
27 Sep 2012 7:17 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
Controllers aren't much, listeners aren't placed on components so there is no need for it really.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Sep 2012 7:30 AM #5
I don't understand. You say listeners are not linked with real DOM-elements? Or Sencha components?
-
27 Sep 2012 7:31 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
In controllers, the listeners in the control config are not actually placed on the components.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote