我在看你的小提琴,但有几件事是错误的。
- CSS 看起来像一个不完整的 Neptune 样式表
- 通过这样做:
items: resultsPanel
在您的区域面板中,您正在该面板内创建一个新面板
- 您在元素上设置了不正确的配置,我的建议是查看ExtJS 文档,它列出了所有有效的配置选项
- 您可能想查看MVC 架构教程
现在对于布局,我不知道您到底想要什么,但这可能很接近:http:
//jsfiddle.net/laurenzonneveld/kVueU/4/
var navigate = function (panel, direction) {
var layout = panel.getLayout();
layout[direction]();
Ext.getCmp('move-prev').setDisabled(!layout.getPrev());
Ext.getCmp('move-next').setDisabled(!layout.getNext());
};
Ext.define('App.view.RequestPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.requestpanel',
title: 'Request Panel',
items: [{
html: 'Sample Result'
}],
bbar: [{
xtype: 'button',
text: 'Search'
}, {
xtype: 'button',
text: 'Reset'
}]
});
Ext.define('App.view.ResultPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.resultpanel',
title: 'Result Panel',
layout: 'card',
items: [{
xtype: 'panel', // Standard panel, but this could be another super complex panel
html: 'Sample Result 1'
}, {
// Defaults to xtype: 'panel', if no xtype is specified
html: 'Sample Result 2'
}, {
// Defaults to xtype: 'panel', if no xtype is specified
html: 'Sample Result 3'
}, {
// Defaults to xtype: 'panel', if no xtype is specified
html: 'Sample Result 4'
}],
bbar: [{
xtype: 'button',
text: 'Previous',
handler: function (btn) {
navigate(btn.up('panel'), 'prev');
}
}, {
xtype: 'button',
text: 'Next',
handler: function (btn) {
navigate(btn.up('panel'), 'next');
}
}]
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Sencha</h1>',
border: false
}, {
xtype: 'requestpanel', // Your super complex panel
region: 'center', // Context specific properties for the panel
layout: 'fit', // Context specific properties for the panel
flex: 1 // Context specific properties for the panel
}, {
region: 'south', // Your super complex panel
xtype: 'resultpanel', // Context specific properties for the panel
flex: 1, // Context specific properties for the panel
collapsible: true, // Context specific properties for the panel
split: true
}]
});
编辑:更新小提琴和代码示例使用Ext.define