我正在尝试创建一个包含四个项目的容器,我需要的是容器作为滚动而不是每个单独项目的容器,而且我希望每个项目都有自己的高度,所以如果这四个项目大于用户可以向下滚动容器以查看其他项目信息的屏幕...
JSFiddle:http: //jsfiddle.net/martuanez/7GV3b/
我的代码:
var store = {
type: 'store',
fields: ['label', 'value'],
data: [{
label: 'label',
value: 'value',
}, {
label: 'label',
value: 'value',
}, {
label: 'label',
value: 'value',
},
]
};
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
name: ('SF' || 'SenchaFiddle'),
launch: function () {
Ext.define('MyApp.view.Contacts.ContactsDetailsView', {
xtype: 'ContactsDetailsView',
extend: 'Ext.Container',
config: {
layout: {
type: 'vbox',
padding: 3
},
defaults: {
scrollable: {
direction: 'horizontal',
directionLock: true
},
height: 500,
layout: 'fit'
},
scrollable: 'vertical',
itemCls: 'details-list-container',
items: [{
xtype: 'dataview', //add xtype
itemId: 'detailItem',
loadingText: 'Loading keys...',
emptyText: '<div>No keys found.</div>',
store: store,
onItemDisclosure: false,
itemTpl: '<br/>item 1:<br/> {label}<br/>{value}<br/><br/>',
itemCls: 'details-list',
selectedItemCls: '',
disableSelection: true,
pressedCls: ''
}, {
xtype: 'list',
itemId: 'detailKeys',
store: store,
loadingText: 'Loading keys...',
emptyText: '<div>No keys found.</div>',
onItemDisclosure: false,
itemTpl: 'item 2: {label}{value}<br/>',
itemCls: 'details-list',
selectedItemCls: '',
disableSelection: true,
pressedCls: ''
}, {
xtype: 'list', //add xtype
itemId: 'detailuserdefs',
store: store,
loadingText: 'Loading userdefs...',
onItemDisclosure: false,
itemTpl: 'item 3: {label}{value}<br/>',
itemCls: 'details-list',
selectedItemCls: '',
disableSelection: true,
pressedCls: ''
}, {
xtype: 'list',
itemId: 'detailOthers',
store: store,
loadingText: 'Loading userdefs...',
onItemDisclosure: true,
itemTpl: 'item 4: {label}{value}<br/>',
itemCls: 'details-list'
}
]
}
});
Ext.Viewport.add(Ext.create('MyApp.view.Contacts.ContactsDetailsView'));
}
});