日期:2014-05-16 浏览次数:20383 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>测试页面</title> <meta http-equiv="content-type" content="text/html; charset=gbk" /> <link rel="stylesheet" type="text/css" href="./ext/resources/css/ext-all.css" /> <script type="text/javascript" src="./ext/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="./ext/ext-all.js"></script> </head> <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'] ]; //定义store var ds = new Ext.data.Store({ proxy:new Ext.data.MemoryProxy(data), reader:new Ext.data.ArrayReader({},[ {name:'id'}, {name:'name'}, {name:'descn'} ]) }); ds.load(); //定义表格 var grid = new Ext.grid.GridPanel({ ds:ds, cm:cm, title:'表格定义示例', width:300, renderTo:'div1', autoHeight:true }); }); </script> <body> <div id='div1'></div> </body> </html>