reconfigure在extjs中不起作用

reconfigure在extjs中不起作用

本文介绍了Grid.reconfigure在extjs中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为网格设置了一个重置​​按钮,该按钮应该重置所有列.代码看起来像这样:

I have a reset button for my grid that is supposed to reset all my columns. Code looks like this :

               function (response) {
                    if (response == 'yes') {

                        Ext.state.Manager.clear(grid.stateId);

                        var cols = grid.initialConfig.columns

                        grid.reconfigure(grid.getStore(), cols);
                    }
                });

grid.reconfigure(..)应该重置表的外观,但是当我运行上面的代码时没有任何反应.

grid.reconfigure(..) is supposed to reset how the table looks, however nothing happens when I run the code above.

我注意到 grid.initialConfig.columns 是未定义的.为什么这是不确定的?是否需要先设置某种初始配置?

I noticed that grid.initialConfig.columns is undefined. Why would this be undefined? Is there some kind of initial configuration that needs to be set first?

(我注意到,使用构造函数时,您可以定义 initialConfiguration .我改用了 initComponent .)

(I notice that when using a constructor you can define an initialConfiguration. I used initComponent instead.)

推荐答案

在网格的initComponent(..)中,我添加了 this.initialConfig.columns = this.columns

In my initComponent(..) for my grid I added this.initialConfig.columns = this.columns

initComponent : function (){
    var me = this;

    this.columns = createColumns();

    this.initialConfig.columns = this.columns;

此问题解决了列的问题:)但不会重置排序:(

This has fixed column issues :) But it doesn't reset sorting :(

这篇关于Grid.reconfigure在extjs中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 20:55