在extjs网格4上显示Json数据

时间:2011-09-05 08:49:35

标签: javascript extjs4

我正在使用json数据研究extjs gid 4上的加载数据

App.js中的代码

/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/

Ext.onReady(function () {

    var proxy = new Ext.data.HttpProxy({ url: 'source.htm' });
    //Reader
    var reader = new Ext.data.JsonReader(
            {

            }, [
                { name: 'appeId', mapping: 'appeId' },
                { name: 'survId' },                         {name: 'location' },
                { name: 'surveyDate' },
                { name: 'surveyTime' },
                { name: 'inputUserId' }
            ]
        )

    var store = new Ext.data.Store({
        proxy: proxy,
        method: 'POST',
        reader: reader
    });
    store.load();


    // create the grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            { header: "appeId", width: 60, dataIndex: 'appeId', sortable: true },
            { header: "survId", width: 60, dataIndex: 'survId', sortable: true },
            { header: "location", width: 60, dataIndex: 'location', sortable: true },
            { header: "surveyDate", width: 100, dataIndex: 'surveyDate', sortable: true },
            { header: "surveyTime", width: 100, dataIndex: 'surveyTime', sortable: true },
            { header: "inputUserId", width: 80, dataIndex: 'inputUserId', sortable: true }
        ],
        renderTo: 'example-grid',
        width: 540,
        height: 200
    });

});

default.aspx中的代码

    <%@ Page Title="Home Page" Language="C#"  AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="ExtsjControlWithJsonData._Default" %>

<html>
<head>
<title></title>

    <link href="resources/css/ext-all.css" rel="stylesheet" type="text/css" />
    <script src="ext.js" type="text/javascript"></script>
    <script src="examples/init.js" type="text/javascript"></script>
    <script src="examples/shared/examples.js" type="text/javascript"></script>
    <script src="bootstrap.js" type="text/javascript"></script>    
    <script src="App.js" type="text/javascript"></script>

</head>
<body>
<div id="example-grid"></div>

</body>
</html>

但我无法在extjs grid 4上加载数据并发生错误:

Line: 25557 Error: 'this.model.prototype' is null or not an object

0 个答案:

没有答案