我从Twitter Bootstrap进入ExtJS并且不确定如何使用哪些组件来获得"行"它会在整个屏幕上显示尽可能多的容器,然后将它们包起来。
绿框是我想移动2个网格的地方:
Ext.onReady(function(){
Ext.define('Test', {
extend: 'Ext.data.Model',
fields: [
'created',
'name'
]
});
var testStore = Ext.create('Ext.data.Store', {
model: 'Test',
data: [
{
name: 'Do Something To Something Else',
created: 'Wednesday'
},
{
name: 'Do Another Thing To Another Thing',
created: 'Thursday'
}
]
});
var activeTasksApplet = Ext.create('Ext.panel.Panel', {
title: 'Active Tasks',
width: 350,
height: 200
});
var testsGrid = Ext.create('Ext.grid.Panel', {
store: testStore,
width: 400,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
});
var pageContents = Ext.create('Ext.container.Viewport', {
layout: 'border',
defaults: {
collapsible: false,
split: true,
bodyStyle: 'padding:15px'
},
items: [
{
title: 'Header',
region: 'north',
height: 120,
minSize: 75,
maxSize: 150,
cmargins: '5 0 0 0'
},
{
title: 'Panels',
region: 'center',
margins: '5 0 0 0',
items: [
testsGrid,
{
title: 'Active Tasks',
margins: '5 0 0 0',
width: 400,
height: 200,
items: Ext.create('Ext.grid.Panel', {
store: testStore,
width: 400,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
})
},
Ext.create('Ext.grid.Panel', {
store: testStore,
width: 400,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
}),
{
title: 'Active Tasks',
margins: '5 0 0 0',
},
{
title: 'Active Tasks',
margins: '5 0 0 0',
}
]
}]
});
});
答案 0 :(得分:2)
更新
好的,这次是正确的解决方案。
使用列布局,它将项目视为具有float
的div文档:http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.layout.container.Column
小提琴:http://jsfiddle.net/8Pqtx/8/
Ext.onReady(function(){
Ext.define('Test', {
extend: 'Ext.data.Model',
fields: [
'created',
'name'
]
});
var testStore = Ext.create('Ext.data.Store', {
model: 'Test',
data: [
{
name: 'Do Something To Something Else',
created: 'Wednesday'
},
{
name: 'Do Another Thing To Another Thing',
created: 'Thursday'
}
]
});
var activeTasksApplet = Ext.create('Ext.panel.Panel', {
title: 'Active Tasks',
height: 200
});
var testsGrid = Ext.create('Ext.grid.Panel', {
store: testStore,
width: 300,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
});
var pageContents = Ext.create('Ext.container.Viewport', {
layout: 'border',
defaults: {
collapsible: false,
split: true,
bodyStyle: 'padding:15px'
},
items: [
{
title: 'Header',
region: 'north',
height: 120,
minSize: 75,
maxSize: 150,
cmargins: '5 0 0 0'
},
{
title: 'Panels',
layout: 'column',
width: 500,
region: 'center',
items: [
testsGrid,
{
title: 'Active Tasks',
width: 200,
height: 200,
items: Ext.create('Ext.grid.Panel', {
store: testStore,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
})
},
Ext.create('Ext.grid.Panel', {
store: testStore,
width: 300,
height: 200,
title: 'Tests',
columns: [
{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}
]
}),
{
title: 'Active Tasks',
width: 100
},
{
title: 'Active Tasks',
width: 100
}
]
}]
});
});