Ill*_*lep 2 extjs sencha-touch extjs4 extjs4.1
我有一个正常工作的GRID.现在我需要将此GRID添加到第一个选项卡面板.我怎样才能做到这一点?
我的代码:
GRID.JS
Ext.create('Ext.grid.Panel', {
xtype:'grid',
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email', flex: 1 },
{ header: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
Run Code Online (Sandbox Code Playgroud)
TAB.JS
Ext.create('Ext.tab.Panel', {
width: 300,
height: 200,
activeTab: 0,
items: [
{
title: 'Tab 1',
xtype:'grid'
},
{
title: 'Tab 2',
html : 'Another one'
}
],
renderTo : Ext.getBody()
});
Run Code Online (Sandbox Code Playgroud)
我已经添加了xtype:grid
GRID.JS,我试图从第一个选项卡中的TAB.JS访问该网格,但它没有显示.
sha*_*sha 10
xtype: 'grid'
-意思create standard Ext.grid.Panel and add it here
.
您有两种选择:
创建网格并将其保存到变量中.
var _grid = Ext.create('...', {...});
Ext.create('Ext.tab.Panel', {
...
items: [
_grid
]
});
Run Code Online (Sandbox Code Playgroud)
或者,用new定义自己的类 xtype
Ext.define('MyGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.mygrid',
...
});
Ext.create('Ext.tab.Panel', {
...
items: [{
xtype: 'mygrid'
}]
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9967 次 |
最近记录: |