登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

脚步轻轻

怕惊扰酣睡的梦境

 
 
 
 
 

日志

 
 

简单的Grid表格示例  

2011-03-24 09:19:39|  分类: 我的文档 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

书籍:ExtJS Web应用程序开发指南

引用文件

<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="../../source/locale/ext-lang-zh_CN.js"></script>

js部分

<script type="text/javascript">
Ext.onReady(function(){

//数据定义
 var data = [[1,'张三',24],[2,'李四',30],[3,'王五',29]];
 var Person = Ext.data.Record.create([
  {name: 'personId', mapping: 0},
  {name: 'personName', mapping: 1},
  {name: 'personAge', mapping: 2},
 ]);

//表格定义
 new Ext.grid.GridPanel({
  title: '简单Grid表格实例',
  applyTo: 'grid-div',
  width: 250,
  height: 150,
  frame: true,
  store: new Ext.data.Store({
   reader: new Ext.data.ArrayReader({id:0}, Person),
   data: data
  }),
  columns:[
   {header: "id", width: 50, dataIndex: 'personId', sortable: true},//dataIndex I必须大写
   {header: "姓名", width: 90, dataIndex: 'personName', sortable: true},
   {header: "年龄", width: 90, dataIndex: 'personAge', sortable: true}
  ]
 });
});
</script>

html部分

<div id='grid-div'></div>

  评论这张
 
阅读(128)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018