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
展开
 我来答
wyg_616
2008-04-17 · 超过21用户采纳过TA的回答
知道答主
回答量:37
采纳率:0%
帮助的人:64.4万
展开全部
<%@ 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>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式