GridPanel加载数据


GridPanel加载数据
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>HelloWorld.html</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="../extjs_lib/resources/css/ext-all.css">
  	<script type="text/javascript" src="../extjs_lib/adapter/ext/ext-base.js"></script>
  	<script type="text/javascript" src="../extjs_lib/ext-all.js"></script>
  	<script type="text/javascript">
  	</script>
  	<script type="text/javascript">
  	Ext.onReady(function() {
  		  		//grid
  		var cm = new Ext.grid.ColumnModel([
  			{header:'编号', dataIndex:'id', sortable: true}, 
  			{header:'名称', dataIndex:'name'}, 
  			{header:'描述', dataIndex:'desc'}
  		]);
  		
  		var data = [
  			['1', 'name1', 'desc1'], 
  			['2', 'name2', 'desc2'], 
  			['3', 'name3', 'desc3'], 
  			['4', 'name4', 'desc4'], 
  			['5', 'name5', 'desc5'], 
  			['6', 'name6', 'desc6']
  		];
  		
  		var store = new Ext.data.Store({
  			proxy: new Ext.data.MemoryProxy(data), 
  			reader: new Ext.data.ArrayReader({}, [
  				{name: 'id'}, 
  				{name: 'name'}, 
  				{name: 'desc'}, 
  			])
  		});
  		
  		store.load();
  		
  		var grid = new Ext.grid.GridPanel({
  			renderTo: 'grid', 
  			store: store, 
  			cm: cm, 
  			shadow: true, 
  			pageX: 20, 
  			width: 350, 
  			height: 200
  		});
  	});
  	</script>
  </head>
  	<div id="test"></div>
  	<div id="grid"></div>
  <body>
  </body>
</html>

 

你可能感兴趣的:(JavaScript,html,css,ext)