-
22 Jan 2013 7:51 AM #1
Dataview will not scroll horizontally if using components as dataitems
Dataview will not scroll horizontally if using components as dataitems
If I set the dataview to use inline wrap = false, the items will do as the documentation states for the dataview's inline config option (2.1.1 docs) if I use theitemTpl config option:
"When set to true the items within the DataView will have their display set to inline-block and be arranged horizontally. By default the items will wrap to the width of the DataView. Passing an object with { wrap: false } will turn off this wrapping behavior and overflowed items will need to be scrolled to horizontally."
Code:{ xtype: 'dataview', flex: 1, defaultType: 'MonitorItem_Tablet', scrollable: 'horizontal', deferEmptyText: false, inline: { wrap: false }, itemTpl: [ '<div>{name}</div>' ], store: 'goodMonitorStore', useComponents: false
SenchaArchitect2.PNG
The overflowed monitors can be seen by scrolling horizontally.
However if I switch this dataview to use components it appears to wrap the items:
Code:{ xtype: 'dataview', flex: 1, defaultType: 'MonitorItem_Tablet', scrollable: 'horizontal', deferEmptyText: false, inline: { wrap: false }, itemTpl: [ '<div>{name}</div>' ], store: 'goodMonitorStore', useComponents: true },
SenchaArchitect1.PNGLast edited by ChrisWalker; 22 Jan 2013 at 7:52 AM. Reason: typo
-
22 Jan 2013 11:03 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
I'm going to open a bug. Here is a pretty good test case that shows this issue:
CSS:Code:Ext.define('MyApp.view.DataItem', { extend : 'Ext.dataview.component.DataItem', xtype : 'myapp-dataitem', config : { text : { cls : 'text-item' }, dataMap : { getText : { setHtml : 'text' } } }, applyText : function(text) { return Ext.factory(text, Ext.Component, this.getText()); }, updateText : function(text) { if (text) { this.add(text); } } }); Ext.application({ name : 'MyApp', viewport : { layout : { type : 'vbox', align : 'stretch' } }, launch : function () { Ext.Viewport.add([ { xtype : 'dataview', flex : 1, inline : { wrap : false }, scrollable : 'horizontal', itemTpl : '<div class="text-item">{text}</div>', store : { fields : ['text'], data : [ { text : 'One' }, { text : 'Two' }, { text : 'Three' }, { text : 'Four' }, { text : 'Five' }, { text : 'Six' }, { text : 'Seven' }, { text : 'Eight' }, { text : 'Nine' }, { text : 'Ten' } ] }, items : [ { xtype : 'toolbar', docked : 'top', title : 'Using itemTpl (correct behavior)' } ] }, { xtype : 'dataview', flex : 1, defaultType : 'myapp-dataitem', scrollable : 'horizontal', useComponents : true, inline : { wrap : false }, store : { fields : ['text'], data : [ { text : 'One' }, { text : 'Two' }, { text : 'Three' }, { text : 'Four' }, { text : 'Five' }, { text : 'Six' }, { text : 'Seven' }, { text : 'Eight' }, { text : 'Nine' }, { text : 'Ten' } ] }, items : [ { xtype : 'toolbar', docked : 'top', title : 'Using Components (incorrect behavior' } ] } ]); } });
Code:.text-item { width : 200px; height : 200px; border : 1px solid #000; margin : 1em; }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.
-
22 Jan 2013 11:47 AM #3
Thanks Mitchell.
Is there a way to track this bug? I can open a support ticket if that would help.
-
22 Jan 2013 12:02 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
It's actually better to track on the forums. As you can see at the top you have the status [OPEN], the bug number. When it gets resolved, it should also send a PM.
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.
-
16 Apr 2013 1:17 PM #5Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
2 Things to make this work:
1) Set the width to null on your dataItem (defaults to 100%)
2) Add this CSS in (this will be in the next release):
Code:.x-dataview-nowrap { .x-container.x-dataview { white-space: nowrap !important; } }
-
17 Apr 2013 9:32 AM #6
Thanks- that did it!
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3929
in
Sprint 33.


Reply With Quote