本文目錄一覽:
Ext動態增加與刪除Panel中組件的問題。急~~ 解決後給加分~~~
試試這樣
{
layout : ‘form’,
border : false,
id :’result_items’,
items : []
}
var panel = new Ext.Panel({
id : ‘itemPanel’,
layout : ‘form’,
border : false,
items : []
});
for(var j = 0; j dataList[0].items.length; j ++){
subPanel = getLink(dataList[0].items[j]);
Ext.getCmp(‘itemPanel’).add(subPanel);
}
Ext.getCmp(‘result_items’).add(panel);
最外層那個formpanel調用一下doLayout()方法。
要重新添加組件就先Ext.getCmp(‘result_items’).remove(Ext.getCmp(‘itemPanel’))
再像上面那樣做
Ext中grid刪除一行問題
白狐說得挺全了,他還給我回答過問題,呵呵
你給你的grid一個id:’test’,然後Ext.getCmp(‘test’);這樣就能獲得grid這個組件了,然後在像白狐說的那樣操作,就可以不刪除數據庫的假刪除操作
你好 刪除formpanel中的全部組件是怎麼弄的?
你好…..
EXT大概是沒有提供刪除formpanel中的全部組件的方法…..但是它提供了刪除單個元素的方法
/**API*/
remove( Component/String component, [Boolean autoDestroy] ) : void
在移除之前觸發beforeremove事件…
從容器中移除一個組件。在移除之前觸發beforeremove事件,接着在移除之後觸發remove 事件。
參數:
component : Component/String
The component reference or id to remove.
autoDestroy : Boolean
(可選) True to automatically invoke the removed Component’s Ext.Component.destroy function.Defaults to the value of this Container’s autoDestroy config.
返回值:void
如果你的formpanel指定放已知類型的組件可以用
var p = Ext.getCmp(“FormPanel_ID”).find(“textfield’); /**textfield為文本框類型*/
for{var i = 0; ip.length;i++}{
Ext.getCmp(“FormPanel_ID”).remove(p[i],teue); //清除所有textfield文本框
}
在formpanel中的的類型也就那麼幾種
網上有人說給個ID但是當你想重新加入組件到formpanel時發現找不到ID…
原創文章,作者:LCRU,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/132672.html