当前位置:编程学习 > JAVA >>

Extjs分组表格展开或折叠报错



<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>分组表格json</title>
<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>
<script type="text/javascript" src="ext/ext-lang-zh_CN-utf8.js"></script>


</head>
<body>
<div id="grid"></div>
<div id="grid2"></div>
</body>

<script languange="javascript">
Ext.onReady(function() {

Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';   
Ext.onReady(function(){   
  
    Ext.QuickTips.init();   
       
    var xg = Ext.grid;   
  
//===============第一种方式获取JSON数据================================//    
/*  
    var reader=new Ext.data.JsonReader({  
                root:'rows',  
                totalProperty:'totalCount',  
                fields:['instructions_no','unit_name','category_name','request_title',  
                        'request_context','require_completion_time','action_name','remark'  
                    ]  
            });  
 
    var store=new Ext.data.GroupingStore({  
            id:'GroupStore',  
            reader: reader,  
            remoteSort:true,  
            sortInfo:{field: 'instructions_no', direction: 'ASC'},  
            groupField:'instructions_no',  
            proxy:new Ext.data.HttpProxy({  
                url:'RequestInfo.do?cmd=List',  
                autoAbort:true,  
                disableCaching:true,  
                timeout:180000,  
                method:'POST'  
            })  
        });  
        store.load();  
*/         
//========================================================================//   
  
//===============第二种方式获取JSON数据================================//    
    var store=new Ext.data.GroupingStore({   
            url:'GroupGridJsonServlet',   
            reader: new Ext.data.JsonReader({   
                root:'rows',   
                totalProperty:'totalCount',   
                remoteSort:true,   
                fields:[   
                    {name:'name'},   
                    {name:'age'}, 
                    {name:'sex'}  
                    
                    ]   
            }),   
            sortInfo:{field: 'name', direction: 'ASC'},   
            groupField:['sex']   
        });   
        store.load();   
//====================================================================//   
  
    var grid = new xg.GridPanel({   
        store: store,   
        columns: [   
                new Ext.grid.RowNumberer(),//获得行号   
                {header: "姓名", sortable:true,width: 300, dataIndex:"name"},   
                {header: "年龄", sortable:true,width: 300, dataIndex:"age"},   
                {header: "性别", sortable:true,width: 300, dataIndex:"sex"}  
        ], 
        view:new Ext.grid.GroupingView(),  
  
       /* view: new Ext.grid.GroupingView({   
            forceFit:true,   
            groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'  
        }), */  
        frame:true,   
        autoWidth: true,   
        height: 450,   
        collapsible: true,   
        animCollapse: false,   
        title: '信息',   
        iconCls: 'icon-grid',   
        renderTo: document.body   
    });   
});


});
</script>
</html>


数据能够正常显示 但是当展开或折叠某一个分组时总是抱错:
对象不支持此属性或方法
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,