sencha touch :: list is not scrolling right
the following code seems to be incomplete or I am doing something wrong? problem is that the list doesn't scroll right.
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 for having a look!
edit: doesn't scroll right means that it is flipping back to initial position when letting loose the grip...
I think the problem is that the parent container won't be able to figure out the height the list should have because there are two children, so 'fit' doesn't really have a meaning. If you change the parent's layout from a fit to a vbox, give the 'topPanel' a fixed height and the list a flex of 1 the two children should fill the screen.
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,
}]
});
Give 'padding-bottom'
style to panel that surrounds two panels.
In my case '100px' is the best.
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,
}]
});
}
});
精彩评论