更改活动选项卡后未加载Extjs存储

时间:2012-12-14 09:48:17

标签: javascript extjs extjs4 extjs4.1 extjs-mvc

我在一边有一个带表名的grid.panel,我想在用户点击它时,在标签视图中的另一个grid.panel中显示表格(或它的结构)。

我做了什么:

在actionlistener中

var store = Ext.data.StoreManager.lookup('Tables');
currentTable = store.findRecord('name',record.get('name'));

var structureView = Ext.ComponentQuery.query('structure')[0];
structureView.showTable(currentTable);
视图中的

showTable: function(table) {
    this.storeObj.getProxy().url = '/tables/stucture/' + table.data.name;
    this.storeObj.load();

    this.update();
}

在Tables商店中,我有表描述符,有一些基本数据,如名称等,带有表名的列表显示了这个商店的内容。因此,我查看Tables存储并获取tabledescriptor并将其传递给视图,然后视图将加载存储(在本例中为“Columns”)及其将显示的数据。所有这一切都正常,直到我切换标签。更改活动选项卡然后更改后退数据没有刷新单击另一个表的名称,我得到这个:未捕获TypeError:无法调用null的方法'removeChild'。在更改活动选项卡后,它似乎无法再加载商店。我在论坛上发现了这个问题,但我找不到解决方案。

你有什么想法吗?

感谢您的时间。

编辑:

Ext.define('App.view.Table.Structure', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.structure',
    store: 'Columns',
    width: 800,
    storeObj: undefined,

    initComponent: function () {

        this.columns = [{
            header: 'Column name',
            dataIndex: 'name',
            flex: 1
        }, {
            header: 'Position',
            dataIndex: 'position',
            flex: 1
        }, {
            header: 'Default value',
            dataIndex: 'defaultValue',
            flex: 1
        }, {
            header: 'Column type',
            dataIndex: 'type',
            flex: 1
        }, ];

        this.storeObj = Ext.StoreManager.lookup('Columns');

        this.callParent(arguments);
    }

1 个答案:

答案 0 :(得分:0)

我终于设法解决了,但我真的不明白为什么这解决了这个问题。所以这就是我所做的:

  • 每次我需要更新Columns商店(或其他商店)时,我都会查找它 而不只是在initcomponent中查找它。
  • 我没有调用update()方法,而是调用了reconfigure()

现在它就像魅力一样,但我不明白为什么更新没有做到这一点,为什么每次我想在它上面调用load()时都要查看商店...所以如果有人可以解释一下,我会很感激。

相关问题