【问题标题】:Grid loaded from JSON file its works in IE but not able to load in fireFox?从 JSON 文件加载的网格在 IE 中工作但无法在 fireFox 中加载?
【发布时间】:2010-12-14 04:41:05
【问题描述】:

我正在使用 ExtJS3.3.1 并尝试从包含 JSON 对象的文件中加载网格。 它可以在 IE 加载带有数据的网格中正常工作,但不能在 Firefox 中工作。 这是简单的代码它不会给出任何错误和警告。

var store = new Ext.data.Store({

    url: 'http://localhost/Vaishali/src/survey.html',

    reader: new Ext.data.JsonReader({
        root: 'data',
        id: 'appeId',
        totalProperty: 'total'
    }, [{
        name: 'appeId',
        mapping: 'appeId'
    }, {
        name: 'survId',
        mapping: 'survId'
    }, {
        name: 'location',
        mapping: 'location'
    }, {
        name: 'surveyDate',
        mapping: 'surveyDate'
    }, {
        name: 'surveyTime',
        mapping: 'surveyTime'
    }, {
        name: 'inputUserId',
        mapping: 'inputUserId'
    }])
});

store.load();

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
    }],
    width: 540,
    height: 200
});

所以你能告诉我为什么会发生这种情况。 哎呀 当我添加事件 onload 并在 mozilla firefox 中检查异常时,它将在该状态代码中显示异常,显示 0 和文本“连接失败”。 但在 IE 中它会给出正确的连接和结果。

【问题讨论】:

    标签: json extjs grid


    【解决方案1】:

    我怀疑您也没有从http://localhost/ 加载页面,因此您与same origin policy 发生冲突。 IE 比严格来说更宽容。

    【讨论】:

    • 是的。我没有从服务器运行该文件,这就是问题所在。现在正常工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 2016-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多