【问题标题】:Local store not working in Internet Explorer - Ext JS本地商店在 Internet Explorer 中不起作用 - Ext JS
【发布时间】:2013-08-10 09:51:20
【问题描述】:

我在这里有一个本地商店,我将其放入我的应用程序中。它在 Firefox 中运行良好,但是当我在 Internet Explorer(9) 中启动它时,整个应用程序崩溃了。有什么想法吗?

代码如下:

var filters_2 = Ext.create('Ext.data.Store', { //temp store
    fields: ['field1'],
    data : [
        { field1: 'Filter 1' },
        { field1: 'Filter 2' },
        { field1: 'Filter 3' }
    ]
});

(这个商店的目的是将字段加载到我应用程序其他地方的组合框中)

我是否缺少对这种性质的要求或某些东西?有什么想法吗?

【问题讨论】:

    标签: extjs internet-explorer-9 store


    【解决方案1】:

    尝试在数据的引号中添加 field1

    var filters_2 = Ext.create('Ext.data.Store', { //temp store
    fields: ['field1'],
    data : [
        { 'field1': 'Filter 1' },
        { 'field1': 'Filter 2' },
        { 'field1': 'Filter 3' }
    ]
    

    });

    【讨论】:

    • 这大概就是我现在想的吧。
    • 我试过这个,但它再次在 IE 中不起作用。我的错误是:ext-debug.js,第 4101 行字符 13
    • 我通过给我的过滤器一个 id 并从我的按钮控制器调用它来解决它。 (商店:'filterID')
    • 我还必须将商店放入我的启动功能中。这似乎有些不对劲……
    【解决方案2】:

    尝试为您的商店定义一个模型,有时 extjs 不能很好地处理“字段”配置选项,因为它只是为了向后兼容已更新为适用于 4.X 的 Extjs 3.X 代码。

    Ext.define("FilterModel", {
        extend: "Ext.data.Model",
        fields: [
            {name: "field1", type: "string"}
        ]
    });
    
    var filters_2 = Ext.create('Ext.data.Store', { //temp store
        model: "FilterModel",
        data : [
            { field1: 'Filter 1' },
            { field2: 'Filter 2' },
            { field3: 'Filter 3' }
        ]
    });
    

    【讨论】:

    • 我也试过了,但在 IE 中我得到的只是错误:ext-debug.js, line 4101 character 13
    猜你喜欢
    • 1970-01-01
    • 2014-02-03
    • 2015-10-13
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    相关资源
    最近更新 更多