在 extjs 网格上显示 Json 数据 4
我正在研究如何使用 json 数据在 extjs gid 4 上加载数据
App.js 中的
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* [email protected]
*
* 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 上加载数据并发生错误:
行:25557 错误:“this.model.prototype”为 null 或不是对象
I am researching about load data on extjs gid 4 using json data
Code in App.js
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* [email protected]
*
* 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
});
});
Code in 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>
But i cannot load data on extjs grid 4 and error occured:
Line: 25557
Error: 'this.model.prototype' is null or not an object
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论