上代码:
html 页面
<html>
<head>
<title>测试数据</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../share/ext2.0.2/resources/css/ext-all.css"/>
<script type="text/javascript" src="../../share/ext2.0.2/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="../../share/ext2.0.2/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../../share/ext2.0.2/ext-all-debug.js"></script>
</head>
<body class="body" oncontextmenu="self.event.returnValue=false" scroll="no">
<table width="100%" border="0" valign=top>
<tr>
<td width="70%"> </td>
<td><div id="bt_GetCard"></div></td>
<td><div id="bt_Save"></div></td>
<td><div id="bt_Cancel"></div></td>
</tr>
</table>
<table width="500" border="0" align="center">
<tr><td><div id="test_grid"></div></td></tr>
</table>
</body>
<script type="text/javascript">
Ext.grid.dummyData = [
{Ids: 1, description: \'\', rate: 0},
{Ids: 2, description: \'\', rate: 0},
{Ids: 3, description: \'\', rate: 0},
{Ids: 4, description: \'\', rate: 0},
{Ids: 5, description: \'\', rate: 0}
];
Ext.onReady(function(){
Ext.QuickTips.init();
var xg = Ext.grid;
var reader = new Ext.data.JsonReader({
fields: [
{name: \'Ids\', type: \'int\'},
{name: \'description\', type: \'string\'},
{name: \'rate\', type: \'float\'}
]
});
var dataset = new Ext.data.Store({
reader: reader,
data: xg.dummyData
});
var grid = new xg.EditorGridPanel({
ds: dataset,
columns: [
{
header: \'序 号\',
width: 50,
dataIndex: \'Ids\'
},{
header: "描 述",
width: 300,
dataIndex: \'description\',
hideable: false,
editor: new Ext.form.TextField({
allowBlank: false
})