Extjs问题——windows包容多组件
2016-04-07 17:19
435 查看
问题描述:需要在实现一个Ext.window.Window弹窗,里面包含一个图标和一个表格。出现的问题是只能显示出一个组件。
初始代码:Ext.create('Ext.window.Window',{
title: '基于位置的故障数占比',
width: 800,
height: 600,
layout: 'fit',
modal: true,
items:[
{
xtype:'cartesian',
animation: !Ext.isIE9m && Ext.os.is.Desktop,
background: '#ffffff',
height: 300,
colors: [
'#6aa5db'
],
bind:{
store: '{dashboard.QGBarStore}'
},
axes: [
{
type: 'category',
fields: [
'xvalue'
],
hidden: false,
position: 'bottom'
},
{
type: 'numeric',
fields: [
'yvalue'
],
hidden: false,
position: 'left'
}
],
series: [
{
type: 'bar',
xField: 'xvalue',
yField: [
'yvalue'
]
}
],
interactions: [
{
type: 'panzoom'
}
]
},
{
xtype: 'grid',
border: true,
autoScroll:true,
height:300,
width:'100%',
columns: [
{
header: 'Area_id',
dataIndex: 'xvalue'
},
{
header: 'numbers',
dataIndex:'yvalue'
}
], // One header just for show. There's no data,
store: Ext.create('Ext.data.Store', {
autoLoad:true,
model:'Admin.model.DataXY',
proxy:{
type:'ajax',
url:'~api/qg/bar',
reader: {
type: 'json',
rootProperty: 'data'
}
}
})
}
]
}).show();
解决思路:在windows的item里面放一个容器panel,用该panel盛装需要显示的widgets。
解决之后的代码以及一些小tips:
Ext.create('Ext.window.Window',{
title: '基于位置的故障数占比',
width: 800,
height: 600,
layout: 'fit',
modal: true,
items:[
{
xtype: 'panel',
width:'100%',
height:'100%',
items:[
{
xtype:'cartesian',
animation: !Ext.isIE9m && Ext.os.is.Desktop,
background: '#ffffff',
height: 300,
colors: [
'#6aa5db'
],
bind:{
store: '{dashboard.QGBarStore}'
},
axes: [
{
type: 'category',
fields: [
'xvalue'
],
hidden: false,
position: 'bottom'
},
{
type: 'numeric',
fields: [
'yvalue'
],
hidden: false,
position: 'left'
}
],
series: [
{
type: 'bar',
xField: 'xvalue',
yField: [
'yvalue'
]
}
],
interactions: [
{
type: 'panzoom'
}
]
},
{
xtype: 'grid',
border: true,
autoScroll:true,
height:300,
width:'100%',
columns: [
{
header: 'Area_id',
dataIndex: 'xvalue'
},
{
header: 'numbers',
dataIndex:'yvalue'
}
], // One header just for show. There's no data,
store: Ext.create('Ext.data.Store', {
autoLoad:true,
model:'Admin.model.DataXY',
proxy:{
type:'ajax',
url:'~api/qg/bar',
reader: {
type: 'json',
rootProperty: 'data'
}
}
})
}
]
}
]
}).show();1.需要在弹出窗口之后背景变黑:设置modal:true
2.表格需要显示滚动条,autoScroll:true。但需要注意的是,需要设置表格的高度,否则不会显示。
初始代码:Ext.create('Ext.window.Window',{
title: '基于位置的故障数占比',
width: 800,
height: 600,
layout: 'fit',
modal: true,
items:[
{
xtype:'cartesian',
animation: !Ext.isIE9m && Ext.os.is.Desktop,
background: '#ffffff',
height: 300,
colors: [
'#6aa5db'
],
bind:{
store: '{dashboard.QGBarStore}'
},
axes: [
{
type: 'category',
fields: [
'xvalue'
],
hidden: false,
position: 'bottom'
},
{
type: 'numeric',
fields: [
'yvalue'
],
hidden: false,
position: 'left'
}
],
series: [
{
type: 'bar',
xField: 'xvalue',
yField: [
'yvalue'
]
}
],
interactions: [
{
type: 'panzoom'
}
]
},
{
xtype: 'grid',
border: true,
autoScroll:true,
height:300,
width:'100%',
columns: [
{
header: 'Area_id',
dataIndex: 'xvalue'
},
{
header: 'numbers',
dataIndex:'yvalue'
}
], // One header just for show. There's no data,
store: Ext.create('Ext.data.Store', {
autoLoad:true,
model:'Admin.model.DataXY',
proxy:{
type:'ajax',
url:'~api/qg/bar',
reader: {
type: 'json',
rootProperty: 'data'
}
}
})
}
]
}).show();
解决思路:在windows的item里面放一个容器panel,用该panel盛装需要显示的widgets。
解决之后的代码以及一些小tips:
Ext.create('Ext.window.Window',{
title: '基于位置的故障数占比',
width: 800,
height: 600,
layout: 'fit',
modal: true,
items:[
{
xtype: 'panel',
width:'100%',
height:'100%',
items:[
{
xtype:'cartesian',
animation: !Ext.isIE9m && Ext.os.is.Desktop,
background: '#ffffff',
height: 300,
colors: [
'#6aa5db'
],
bind:{
store: '{dashboard.QGBarStore}'
},
axes: [
{
type: 'category',
fields: [
'xvalue'
],
hidden: false,
position: 'bottom'
},
{
type: 'numeric',
fields: [
'yvalue'
],
hidden: false,
position: 'left'
}
],
series: [
{
type: 'bar',
xField: 'xvalue',
yField: [
'yvalue'
]
}
],
interactions: [
{
type: 'panzoom'
}
]
},
{
xtype: 'grid',
border: true,
autoScroll:true,
height:300,
width:'100%',
columns: [
{
header: 'Area_id',
dataIndex: 'xvalue'
},
{
header: 'numbers',
dataIndex:'yvalue'
}
], // One header just for show. There's no data,
store: Ext.create('Ext.data.Store', {
autoLoad:true,
model:'Admin.model.DataXY',
proxy:{
type:'ajax',
url:'~api/qg/bar',
reader: {
type: 'json',
rootProperty: 'data'
}
}
})
}
]
}
]
}).show();1.需要在弹出窗口之后背景变黑:设置modal:true
2.表格需要显示滚动条,autoScroll:true。但需要注意的是,需要设置表格的高度,否则不会显示。
相关文章推荐
- js 小键盘需求
- jsp页面显示不全问题
- javascript高级选择器querySelector和querySelectorAll全面解析
- json文件的相关细节
- login.jsp
- 关于cookie的初识和运用(js和jq)
- 纯js实现瀑布流布局及ajax动态新增数据
- javaScript获取文档中所有元素节点的个数
- jsp页面 链接中文文件名 找不到页面
- 【笔记】 《js权威指南》- 第15章 脚本化文档 - 15.9 HTML表单
- 原生JavaScript实现Ajax的方法
- JavaScript数据推送Comet技术详解
- jsoncpp库
- js实现商品抛物线加入购物车特效
- DynamicJSONserializer
- JS学习总结
- js中如何传递一个字符串
- 深究<%@include%>和<jsp:include>
- DynamicJson
- 如果一个游戏上面加一个透明层,js能不能实现 点击透明层的任意点 而正常玩游戏