ExtJS 5-将网格面板添加到视口中
Ext JS 5 - add grid panel to viewport
我正在寻找一种将网格面板添加到视口的方法,我尝试使用add()函数,但这对我不起作用。
外部应用程序({name:"MyApp",
launch : function() {
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
border: false,
margin: '0 0 5 0'
}, {
region: 'west',
title: 'Navigation',
width: 250,
collapsible: false,
items : {
// I want to add it just there
xtype : 'gridPanel'
}
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'test test',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel',
activeTab: 0,
items: {
title: 'test Tab',
html: ''
}
}]
});
}
});
thx提前,
您只需要完成代码并使用正确的config&xtype。
我已经复制了你的代码,并在这个小提琴中创建了一个网格,没有任何问题,代码也在下面,以防链接中断。
Ext.application({
name: 'MyApp',
launch: function() {
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
data: {
'items': [{
'name': 'Lisa',
"email": "lisa@simpsons.com",
"phone": "555-111-1224"
}, {
'name': 'Bart',
"email": "bart@simpsons.com",
"phone": "555-222-1234"
}, {
'name': 'Homer',
"email": "homer@simpsons.com",
"phone": "555-222-1244"
}, {
'name': 'Marge',
"email": "marge@simpsons.com"
, "phone": "555-222-1254"
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
}
}
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
border: false,
margin: '0 0 5 0'
}, {
region: 'west',
title: 'Navigation',
width: 250,
collapsible: false,
items: {
// I want to add it just there
xtype: 'grid',
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}],
listeners: {
rowdblclick: function(grid, record, tr, rowIndex, e, eOpts) {
alert(record.get("name"));
}
},
height: 200,
width: 400,
}
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'test test',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel',
activeTab: 0,
items: {
title: 'test Tab',
html: ''
}
}]
});
}
});
相关文章:
- 将视口底部滚动到元素底部
- 使用JavaScript根据窗口/视口的高度动态调整图像大小
- 使用条件语句,使 jquery fadeIn/fadeOut 仅在视口 >= 480px 时才有效
- 宽度为100%的CSS元素位于视口之外
- CSS3:当页面向下滚动到第一个视口时,是否可以在元素上触发转换
- 如何设置浏览器视口大小
- Javascript em根据窗口/视口尺寸调整大小,不影响文档样式的text/css
- 检测视口并重定向到不同的主页
- 如何在按住鼠标按钮且光标在视口外时检测鼠标离开
- iOS iPad平板电脑渲染视口不正确
- 移动设备上的视口问题
- 视口大小更改时自动刷新页面
- 在移动设备上获取视口大小
- 当任何块级元素的视口较窄时,添加水平滚动条
- 检查侧载视口的宽度,如果小于 X,则向主体添加类
- 当元素到达视口顶部时添加类
- 添加'X'视口高度滚动的数量
- 我想定义一个css样式表或添加一个依赖于视口大小的主体类
- ExtJS:动态地将项目添加到视口区域
- 如果元素不在视口,则向其添加类