1
我需要一個將從ExtJS 4網格添加/刪除列的函數。 網格是用Extjs 4編寫的。當我谷歌後,我發現了下面的代碼。從Extjs4網格添加/刪除列
function reconfigure(store, columns) {
// debugger;
var me = grid;
if (me.lockable) {
me.reconfigureLockable(store, columns);
return;
}
if (columns) {
me.headerCt.removeAll();
me.headerCt.add(columns);
}
if (store) {
store = Ext.StoreManager.lookup(store);
me.bindStore(store);
// me.getView().refresh();
} else {
me.getView().refresh();
}
}
此代碼,我打電話給這個函數
var store = grid.getStore();
reconfigure(store, fields);
這是更換標題行,但不會刷新數據。我正在使用ExtJs 4.0
爲什麼你只配置列的所有 '桶',和有問題秀並在需要時隱藏它們?當你刪除所有並添加新設置的選項幾乎就像摧毀整個網格,並創建一個新的... – bensiu
我試過了,但它的工作非常緩慢 –
你不應該將網格傳遞到reconfigure函數嗎?一個全局範圍的變量是一個壞主意 – JamesHalsall