ext2.3中Viewport布局使用renderTo
需要将comBok(下拉)显示在tabpanel选项卡中div层里JS代码如下.页面只引入了JS文件:Ext.onReady(function(){vardata=[['...
需要将comBok(下拉)显示在tabpanel选项卡中div层里
JS代码如下.页面只引入了JS文件:
Ext.onReady(function (){
var data=[['1','name1','d1'],
['2','name2','d2'],
['3','name3','d3'],
['4','name4','d4']
]
//布局
var bei=new Ext.Panel({
title:"北方",
height:100,
region:"north",
split:true
})
//下拉数据
var tab1data = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({},[
{name:"noid",mapping:0},
{name:"noname",mapping:1},
{name:"nova",mapping:2}
])
})
//下拉
var comBok=new Ext.form.ComboBox({
pageSize:1,
renderTo:"bkdivtop", //tabpanel中层的ID
triggerAction:"all",
store:tab1data,
displayField:"noname",
valueField:"nova",
mode:"local",
emptyText:"选择"
})
//选项卡
var tabpanel= new Ext.TabPanel({
region:"north",
deferredRender:true,
layoutOnTabChange:true,
defaults:{autoHeight:true},
items:[{
title:"选项1",
items:[bei],
html:"<div id='bkdivtop'>1</div><div id='bkdiv'></div>"
},{
title:"选项2",
bodyStyle:'padding:20px'
}],
activeItem:0
})
//布局
var dong=new Ext.Panel({
title:"东方",
width:300,
height:300,
region:"east",
split:false,
draggable:false,
border:true,
collapsible:true,
items:[tabpanel]
})
//布局
var zhong=new Ext.Panel({
region:"center",
split:true,
html:"<div id='map' style='background-color: #ACFFCD;width: 100%;height: 100%;border-style:solid'></div>"
})
var vp= new Ext.Viewport({
layout:'border',
items:[zhong,dong]
})
})
使用renderTo报'null'为空不是对象,使用applyTo报'this.el.dom'为空不是对象.. 展开
JS代码如下.页面只引入了JS文件:
Ext.onReady(function (){
var data=[['1','name1','d1'],
['2','name2','d2'],
['3','name3','d3'],
['4','name4','d4']
]
//布局
var bei=new Ext.Panel({
title:"北方",
height:100,
region:"north",
split:true
})
//下拉数据
var tab1data = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({},[
{name:"noid",mapping:0},
{name:"noname",mapping:1},
{name:"nova",mapping:2}
])
})
//下拉
var comBok=new Ext.form.ComboBox({
pageSize:1,
renderTo:"bkdivtop", //tabpanel中层的ID
triggerAction:"all",
store:tab1data,
displayField:"noname",
valueField:"nova",
mode:"local",
emptyText:"选择"
})
//选项卡
var tabpanel= new Ext.TabPanel({
region:"north",
deferredRender:true,
layoutOnTabChange:true,
defaults:{autoHeight:true},
items:[{
title:"选项1",
items:[bei],
html:"<div id='bkdivtop'>1</div><div id='bkdiv'></div>"
},{
title:"选项2",
bodyStyle:'padding:20px'
}],
activeItem:0
})
//布局
var dong=new Ext.Panel({
title:"东方",
width:300,
height:300,
region:"east",
split:false,
draggable:false,
border:true,
collapsible:true,
items:[tabpanel]
})
//布局
var zhong=new Ext.Panel({
region:"center",
split:true,
html:"<div id='map' style='background-color: #ACFFCD;width: 100%;height: 100%;border-style:solid'></div>"
})
var vp= new Ext.Viewport({
layout:'border',
items:[zhong,dong]
})
})
使用renderTo报'null'为空不是对象,使用applyTo报'this.el.dom'为空不是对象.. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询