ExtJS 网格 JSON 存储代理错误

发布于 2024-09-26 21:44:23 字数 2633 浏览 0 评论 0原文

我正在努力显示 ExtJS 网格。除了 Json 存储中有关代理的部分外,我的一切都正确。当我尝试显示它时,它会抛出一个错误:

this.proxy is undefined
Ext.data.Store=function(A){this.data=n...ta=C;this.resumeEvents();return B}});

我发现我需要在商店中做一些事情,但不确定做什么。变量列表数据具有 Json 数组字符串。非常感谢任何帮助。谢谢

var listData = <%= aItems %> ;
var AIGrid;

Ext.onReady(function () {
    var AIRecord = Ext.data.Record.create([{
        name: "ID",
        type: "int",
        mapping: "ID"
    }, {
        name: "WSTITLE",
        type: "string",
        mapping: "WSTITLE"
    }, {
        name: "REQ_ATTUID",
        type: "string",
        mapping: "REQ_ATTUID"
    }, {
        name: "DESCRIPTION",
        type: "string",
        mapping: "DESCRIPTION"
    }, {
        name: "RES_ATTUID",
        type: "string",
        mapping: "RES_ATTUID"
    }, {
        name: "RESOLUTION",
        type: "string",
        mapping: "RESOLUTION"
    }, {
        name: "START_TIME",
        type: "string",
        mapping: "START_TIME"
    }, {
        name: "END_TIME",
        type: "string",
        mapping: "END_TIME"
    }]);

    var AIreader = new Ext.data.JsonReader({
        root: "root",
        id: "ID"
    }, AIRecord);

    var AIstore = new Ext.data.Store({
        nocache: true,
        data: listData,
        reader: AIreader
    });

    var AIcol = new Ext.grid.ColumnModel([{
        header: 'ID',
        readOnly: true,
        dataIndex: 'ID',
        width: 30
    }, {
        header: 'Work Step',
        dataIndex: 'WSTITLE',
        width: 200,
        readOnly: true
    }, {
        header: 'Requester',
        dataIndex: 'REQ_ATTUID',
        width: 80,
        readOnly: true
    }, {
        header: 'Description',
        dataIndex: 'DESCRIPTION',
        width: 300,
        readOnly: true
    }, {
        header: 'Resolver',
        dataIndex: 'RES_ATTUID',
        width: 80,
        readOnly: true
    }, {
        header: 'Resolution',
        dataIndex: 'RESOLUTION',
        width: 300,
        readOnly: true
    }, {
        header: 'Start',
        dataIndex: 'START_TIME',
        width: 100,
        readOnly: true
    }, {
        header: 'End',
        dataIndex: 'END_TIME',
        width: 100,
        readOnly: true
    }]);

    AIcol.defaultSortable = true;

    AIGrid = new Ext.grid.GridPanel({
        store: AIstore,
        renderTo: 'listgrid',
        cm: AIcol,
        enableColLock: true,
        title: 'Open Action Items',
        width: 900,
        height: 500,
        selModel: new Ext.grid.RowSelectionModel({
            singleSelect: true
        })
    });

    AIGrid.store.load();

});

I am working on displaying a ExtJS Grid. I got everything correct except the part about proxy with in the Json store. When I try to display it throws an error:

this.proxy is undefined
Ext.data.Store=function(A){this.data=n...ta=C;this.resumeEvents();return B}});

I figured out that i need to do something in the store but not sure what. the variable list data has the Json Array string. Please any help is really appreciated. thanks

var listData = <%= aItems %> ;
var AIGrid;

Ext.onReady(function () {
    var AIRecord = Ext.data.Record.create([{
        name: "ID",
        type: "int",
        mapping: "ID"
    }, {
        name: "WSTITLE",
        type: "string",
        mapping: "WSTITLE"
    }, {
        name: "REQ_ATTUID",
        type: "string",
        mapping: "REQ_ATTUID"
    }, {
        name: "DESCRIPTION",
        type: "string",
        mapping: "DESCRIPTION"
    }, {
        name: "RES_ATTUID",
        type: "string",
        mapping: "RES_ATTUID"
    }, {
        name: "RESOLUTION",
        type: "string",
        mapping: "RESOLUTION"
    }, {
        name: "START_TIME",
        type: "string",
        mapping: "START_TIME"
    }, {
        name: "END_TIME",
        type: "string",
        mapping: "END_TIME"
    }]);

    var AIreader = new Ext.data.JsonReader({
        root: "root",
        id: "ID"
    }, AIRecord);

    var AIstore = new Ext.data.Store({
        nocache: true,
        data: listData,
        reader: AIreader
    });

    var AIcol = new Ext.grid.ColumnModel([{
        header: 'ID',
        readOnly: true,
        dataIndex: 'ID',
        width: 30
    }, {
        header: 'Work Step',
        dataIndex: 'WSTITLE',
        width: 200,
        readOnly: true
    }, {
        header: 'Requester',
        dataIndex: 'REQ_ATTUID',
        width: 80,
        readOnly: true
    }, {
        header: 'Description',
        dataIndex: 'DESCRIPTION',
        width: 300,
        readOnly: true
    }, {
        header: 'Resolver',
        dataIndex: 'RES_ATTUID',
        width: 80,
        readOnly: true
    }, {
        header: 'Resolution',
        dataIndex: 'RESOLUTION',
        width: 300,
        readOnly: true
    }, {
        header: 'Start',
        dataIndex: 'START_TIME',
        width: 100,
        readOnly: true
    }, {
        header: 'End',
        dataIndex: 'END_TIME',
        width: 100,
        readOnly: true
    }]);

    AIcol.defaultSortable = true;

    AIGrid = new Ext.grid.GridPanel({
        store: AIstore,
        renderTo: 'listgrid',
        cm: AIcol,
        enableColLock: true,
        title: 'Open Action Items',
        width: 900,
        height: 500,
        selModel: new Ext.grid.RowSelectionModel({
            singleSelect: true
        })
    });

    AIGrid.store.load();

});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苄①跕圉湢 2024-10-03 21:44:23

我得到了答案。通过互联网进行一些额外的研究。我使用MemoryProxy加载本地数据。这解决了问题。耶!!

I got the answer. with a little extra research over the internets. I used MemoryProxy to load the local data. that solved the problem. Yay!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文