开发者

Cannot delete ExtJs GridPanel from a ExtJs Panel

开发者 https://www.devze.com 2023-01-19 12:34 出处:网络
I have a Panel that starts with an empty items collection. During the course of the application, it becomes necessary to add an GridPanel to the Panel. This appears to work fine.

I have a Panel that starts with an empty items collection. During the course of the application, it becomes necessary to add an GridPanel to the Panel. This appears to work fine.

At some other point in the application, it becomes necessary to remove the GridPanel, and add another one. I have tried several methods to clear the Panels contents, but with no joy.

Iterating through the items collection and called disable() doesn't work.

Calling items.removeAt(index) doesn't work.

Calling removeAll(true) doesn't work.

The grid stays there and is visible, still throwing all the same events. If I go through my load grid procedure, only one grid is displayed. But the requirements of the application are such that the grid should be cleared when there is a change in 开发者_高级运维the criteria for the data that filled the grid.


I believe I have solved my issue.

Calling remove(itemName, true) seems to be the trick.

Though I would be curious to any that could offer insight as to why removeAll(true) doesn't work.


How are you adding the GridPanel? You could hide() the GridPanel in the closure that you create it and add it. Or you can try calling remove(panel) with the GridPanel object on the parent component. I think disable() doesn't hide the GridPanel as well, IIRC.


This is what i have done for one of my ext projects

click: function () {
    var tempRef = Ext.getCmp("createPanel");

    tempRef.remove(Ext.getCmp("step2"),false);
    tempRef.doLayout();
    tempRef.update();

    tempRef.insert(1,Ext.getCmp("step1"));
    tempRef.doLayout();

    Ext.getCmp("backButton").disable();
    Ext.getCmp("backNext").enable();
}

This is code for one of my buttons.

0

精彩评论

暂无评论...
验证码 换一张
取 消