-
25 Oct 2012 4:58 PM #1
DataView.select() function no longer works in 2.1.0-rc2
DataView.select() function no longer works in 2.1.0-rc2
DESCRIPTION:
I used to have a horizontal scrolling list in 2.0.1.1. It worked. Then in the 2.1 betas it got broken. In the 2.1.0-rc2 I had to switch the list to a dataview in order to be able to scroll horizontally. Now, however, the "select()" function does not select the dataitem.
PROBLEM:
DataView.select() function has no effect. In "initialize" I specify to select/hilite the first dataview item. It does not hilite it. The dataview has a class assigned to it for the "selected" state - which changes the selected item's background from gray to white.
REPRO:
Here is a working demo using 2.1.0-rc2
1. After initial page load, all items' background is gray. This is incorrect. The "select()" function was called on the first item (ABOUT), yet it is not hilited.
2. Click on the first item (ABOUT). Notice nothing happens, since it is already selected. If an item is selected and you click on it again, nothing will happen. This is proof that it's already selected, yet it's not hilited since the "select()" function doesn't work.
3. Click another item. Notice its background changed to white.
4. Click the first item (ABOUT) again, notice its background changed to white now.
5. When you click an item, the "itemtap" even is handled internally. I don't have anything in the code that handles the "itemtap" event.
IMPORTANT:
Here is the same code using 2.0.1.1.
Notice as soon as the page loads, the first item (ABOUT) is hilited (using the select() function). This is not possible in 2.1.0-rc2.
DataView code. The select() function is being called from "initialize".
DOWNLOADS:Code:Ext.define('Test.view.HList', { extend: 'Ext.DataView', xtype: 'hlist', config: { fullscreen: true, height: 128, baseCls: 'navbar-list', selectedCls: 'navbar-list-item-selected', pressedCls: 'navbar-list-item-pressed', inline: { wrap: false }, scrollable: { direction: 'horizontal', directionLock: true }, itemTpl: [ '<div class="navbar-list-items-container">', '<div style="background: transparent url(\'{img}\') 0 0 no-repeat; width: 96px; height: 96px; border: 1px solid #2c2c2c; float: left; margin-right: 16px;"></div>', '<div class="navbar-list-item-text">', '<div class="navbar-list-item-text-title">{title}</div>', '<div class="navbar-list-item-text-copy">{text}</div>', '</div>', '</div>' ], store: { fields: ['title', 'text', 'img'], data: [ { title: 'About', text: 'Read something about us and find out why my name is Trinity. Or Jack? Mary? Handsome? Dr. Who?', img: 'resources/images/nav-about.jpg' }, { title: 'Programs', text: 'We created lots and lots of blurry images. We\'re not really sure why. Maybe because they\'re blurry...?', img: 'resources/images/nav-programs.jpg' }, { title: 'Locations', text: 'We are here, we are there, we are everywhere! Just check the map if you don\'t believe me.', img: 'resources/images/nav-locations.jpg' }, { title: 'Blog', text: 'We wrote all sorts of jibberish, full of typos and spelling errors and put them on WordPress.', img: 'resources/images/nav-blog.jpg' }, { title: 'Contact', text: 'No need to dream of close encounters of the third kind. Call us at Re-Mi-Do-Do-So. Operators are standing by.', img: 'resources/images/nav-contact.jpg' } ] } }, initialize: function() { this.callParent(arguments); this.select(0, false, false); } });
Zipped project (small). In "index.htm" point to y our local sencha installation directory.
-
26 Oct 2012 7:40 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Looks like when the items are rendered the selection is not looked at.
For now you could do this instead of this.select(...)
Code:this.onAfter('refresh', function() { this.select(0, false, false); }, this, { single : 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.
-
26 Oct 2012 2:24 PM #3
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3627
in
Sprint 29.


Reply With Quote