Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 销毁后再次添加动态网格列_Extjs_Extjs Grid - Fatal编程技术网

Extjs 销毁后再次添加动态网格列

Extjs 销毁后再次添加动态网格列,extjs,extjs-grid,Extjs,Extjs Grid,我正在尝试使用this.columns.push()将列添加到initComponent()中的ExtJS网格中 这很好,但是当我销毁视图并再次创建它时,列会被复制。ExtJS似乎保留了前一个实例的一些状态。我甚至尝试在destroy()中重置列数组,但无法消除这种奇怪的行为 查看此代码。尝试这种方法,它应该会起作用 var grid, columnsArr = []; grid.reconfigure(undefined, columnsArr); 第一个参数是存储引用。传递对新存储的引用如

我正在尝试使用
this.columns.push()
将列添加到
initComponent()中的ExtJS网格中

这很好,但是当我销毁视图并再次创建它时,列会被复制。ExtJS似乎保留了前一个实例的一些状态。我甚至尝试在
destroy()
中重置列数组,但无法消除这种奇怪的行为


查看此代码。

尝试这种方法,它应该会起作用

var grid, columnsArr = [];
grid.reconfigure(undefined, columnsArr);

第一个参数是存储引用。传递对新存储的引用如果您也希望更改存储

尝试这种方法,它应该会起作用

var grid, columnsArr = [];
grid.reconfigure(undefined, columnsArr);

第一个参数是存储引用。如果还希望更改存储,请传递对新存储的引用

将其添加到initComponent的第一行:
this.columns=Ext.Array.clone(this.columns)@Evantimboli,谢谢这解决了我的问题。你能解释一下为什么需要这个吗?您可以添加您的注释作为答案,这样我就可以接受它了。将其添加到initComponent的第一行:
this.columns=Ext.Array.clone(this.columns)@Evantimboli,谢谢这解决了我的问题。你能解释一下为什么需要这个吗?你可以加上你的评论作为回答,这样我就可以接受了。