以下代码似乎不完整或我做错了什么? 问题是列表没有向右滚动。
Ext.ns('simfla.ux.plugins.demo');
Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
simfla.ux.plugins.demo.store = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'}
]
})
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady : function() {
var app = new Ext.Panel({
fullscreen: true,
layout: 'fit',
dockedItems:[{
xtype: 'toolbar',
title: 'EditableList Plugin',
}],
items: [
{
xtype: 'panel',
title:'topPanel',
items:{
xtype:'button',
cls: 'editChildBtn',
text: 'Einstellungen',
width: 150,
handler: function(){}
}
},
{
xtype: 'list',
style: 'background-color: Transparent;',
id: 'MyList',
allowDeselect: true,
clearSelectionOnDeactivate: true,
//layout: 'fit',
store: simfla.ux.plugins.demo.store,
itemTpl: '{firstName} <strong>{lastName}</strong>',
grouped: false,
indexBar: false,
singleSelect: true,
}]
});
}
});
thanx看看!
编辑:不向右滚动意味着当松开手柄时它会重新回到初始位置...
答案 0 :(得分:4)
我认为问题是父容器无法计算出列表应该具有的高度,因为有两个孩子,所以'fit'并没有真正意义。如果您将父级的布局从适合更改为vbox,请将“topPanel”更改为固定高度,并将列表灵活性设为1,这两个子项应填充屏幕。
var app = new Ext.Panel({
fullscreen: true,
layout: {
type: 'vbox',
align: 'stretch'
},
dockedItems:[{
xtype: 'toolbar',
title: 'EditableList Plugin',
}],
items: [
{
xtype: 'panel',
title:'topPanel',
height: 50,
items:{
xtype:'button',
cls: 'editChildBtn',
text: 'Einstellungen',
width: 150,
handler: function(){}
}
},
{
xtype: 'list',
flex: 1,
style: 'background-color: Transparent;',
id: 'MyList',
allowDeselect: true,
clearSelectionOnDeactivate: true,
//layout: 'fit',
store: simfla.ux.plugins.demo.store,
itemTpl: '{firstName} <strong>{lastName}</strong>',
grouped: false,
indexBar: false,
singleSelect: true,
}]
});
答案 1 :(得分:1)
将'padding-bottom'
样式赋予围绕两个面板的面板。
在我的情况下,'100px'是最好的。
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady : function() {
var app = new Ext.Panel({
fullscreen: true,
layout: 'fit',
style: 'padding-bottom:100px;',
dockedItems:[{
xtype: 'toolbar',
title: 'EditableList Plugin',
}],
items: [
{
xtype: 'panel',
title:'topPanel',
items:{
xtype:'button',
cls: 'editChildBtn',
text: 'Einstellungen',
width: 150,
handler: function(){}
}
},
{
xtype: 'list',
style: 'background-color: Transparent;',
id: 'MyList',
allowDeselect: true,
clearSelectionOnDeactivate: true,
//layout: 'fit',
store: simfla.ux.plugins.demo.store,
itemTpl: '{firstName} <strong>{lastName}</strong>',
grouped: false,
indexBar: false,
singleSelect: true,
}]
});
}
});