ext panel里+grid 奇怪问题
<script>Ext.onReady(function(){varcm=newExt.grid.ColumnModel([{header:'编号',dataIndex:...
<script>
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var data = [
['1','name1','descn1'],
['2','name2','descn2'],
['3','name3','descn3'],
['4','name4','descn4'],
['5','name5','descn5']
];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: myReader
});
ds.load();
var grid = new Ext.grid.GridPanel({
//el: 'grid',
ds: ds,
cm: cm,
viewConfig: {
forceFit: true
},
renderTo: 'content',
title: 'My First Grid',
width: 500,
frame: true
});
grid.render();
//--------------
var panel = new Ext.Panel({
renderTo: 'panel',
title:'panel',
collapsible:true,
width:450,
height:400,
items:[grid] //管理grid
});
//-------------
});
</script>
</head>
<body>
<div id ="content"> //或 panel
</div>
</body>
</html>
沿虚线分开的 单独的一段加上就是报错 我想用panel 加grid 后 直接div 用panel 展开
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var data = [
['1','name1','descn1'],
['2','name2','descn2'],
['3','name3','descn3'],
['4','name4','descn4'],
['5','name5','descn5']
];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: myReader
});
ds.load();
var grid = new Ext.grid.GridPanel({
//el: 'grid',
ds: ds,
cm: cm,
viewConfig: {
forceFit: true
},
renderTo: 'content',
title: 'My First Grid',
width: 500,
frame: true
});
grid.render();
//--------------
var panel = new Ext.Panel({
renderTo: 'panel',
title:'panel',
collapsible:true,
width:450,
height:400,
items:[grid] //管理grid
});
//-------------
});
</script>
</head>
<body>
<div id ="content"> //或 panel
</div>
</body>
</html>
沿虚线分开的 单独的一段加上就是报错 我想用panel 加grid 后 直接div 用panel 展开
1个回答
展开全部
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'demo2.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="../ext2/resources/css/ext-all.css" />
<script type="text/javascript" src="../ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext2/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var data = [
['1','name1','descn1'],
['2','name2','descn2'],
['3','name3','descn3'],
['4','name4','descn4'],
['5','name5','descn5']
];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: myReader
});
ds.load();
var grid = new Ext.grid.GridPanel({
//el: 'grid',
ds: ds,
cm: cm,
viewConfig: {
forceFit: true
},
//renderTo: 'content',
title: 'My First Grid',
width: 500,
frame: true
});
//--------------
var panel = new Ext.Panel({
renderTo: 'content',
title:'panel',
collapsible:true,
width:450,
height:400,
items:[grid] //管理grid
});
//-------------
});
</script>
</head>
<body>
<div id ="content">
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'demo2.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="../ext2/resources/css/ext-all.css" />
<script type="text/javascript" src="../ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext2/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var data = [
['1','name1','descn1'],
['2','name2','descn2'],
['3','name3','descn3'],
['4','name4','descn4'],
['5','name5','descn5']
];
var myReader = new Ext.data.ArrayReader({}, [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: myReader
});
ds.load();
var grid = new Ext.grid.GridPanel({
//el: 'grid',
ds: ds,
cm: cm,
viewConfig: {
forceFit: true
},
//renderTo: 'content',
title: 'My First Grid',
width: 500,
frame: true
});
//--------------
var panel = new Ext.Panel({
renderTo: 'content',
title:'panel',
collapsible:true,
width:450,
height:400,
items:[grid] //管理grid
});
//-------------
});
</script>
</head>
<body>
<div id ="content">
</div>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询