当前位置: 代码迷 >> Java Web开发 >> ExtJs报表没有显示数据
  详细解决方案

ExtJs报表没有显示数据

热度:9598   发布时间:2013-02-25 21:10:27.0
ExtJs表格没有显示数据
菜鸟求助,为什么下面的代码没有显示。求解。。。。。
JS如下:
JScript code
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 store = new Ext.data.Store({        proxy:new Ext.data.MemoryProxy(data),        reader:new Ext.data.ArrayReader([                {name:'id'},                {name:'name'},                {name:'descn'}            ])    });    store.load();    var grid = new Ext.grid.GridPanel({        renderTo:'grid',        store:store,        cm:cm    });});


HTML如下:
HTML code
<html>    <head>           <meta http-equiv="content-type" content="text/html; charset=utf-8">        <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-debug.js"></script>        <script type="text/javascript" src="Hello.js"></script>        <script type="text/javascript" src="../../source/locale/ext-lang-zh_CN.js"></script>    </head>    <body>        <div id='grid'></div>    </body></html>


结果如下:


------解决方案--------------------------------------------------------
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
把这一部分放到
var store = new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(data),
reader:new Ext.data.ArrayReader([
{name:'id'},
{name:'name'},
{name:'descn'}
])
});
后面,dataIndex:''指向已经定义好的列,你都没定义,怎么使用
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Sat May 26 06:14:41 CST 2018
  • 最近登录:Sat May 26 06:14:41 CST 2018
  • 最近登录:Sat May 26 06:14:41 CST 2018
  • 最近登录:Sat May 26 06:14:41 CST 2018
  • 最近登录:Sat May 26 06:14:41 CST 2018