Hybrid View
-
7 Mar 2012 1:04 AM #1
Unanswered: How on first load to show a dataView contents completely scrolled down for a chat
Unanswered: How on first load to show a dataView contents completely scrolled down for a chat
I now do it with this code:
Note that I need a setTimeout(), because when I receive the callback the list is not rendered yet.Code:var _this = this; store.addListener('load', function() { setTimeout(function() { _this.scrollToBottom(true); }, 500); });
-
7 Mar 2012 7:25 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
You need to get the scroller class so you can use the scrollToEnd. To do this:
Now you can doCode:var scroller = dataview.getScrollable().getScroller();
Code:scroller.scrollToEnd(true);
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.
-
7 Mar 2012 7:28 AM #3
I do this in
_this.scrollToBottom(true);.The problem is that I need a setTimeout for this to have effect. Is there some kind of event, view method override I can use for this?
-
7 Mar 2012 7:31 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
You can listen for the refresh event on the dataview. That should technically fire after the items are rendered, may need to use the after order or single option:
Code:dataview.on('refresh', function() {}, dataview, { single : true }, 'after');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.
-
8 Mar 2012 6:06 AM #5
Actually this works when the data is already found in the store. However when the data has to be retrieved from the proxy (first time load), then this callback does not fire at the right moment. Could this be a bug, or is this expected behaviour?
-
8 Mar 2012 7:41 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
The refresh event should fire after after the store has data as the dataview reflects the data in the store.
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