項(xiàng)目中需要實(shí)現(xiàn)導(dǎo)航樹到表格的拖拽功能, 但是當(dāng)我將表格中的記錄 逐個清空(gridStore.remove(rec)) 后, 發(fā)現(xiàn)節(jié)點(diǎn)信息再也拖不進(jìn)來了,但是 一次性清空(gridStore.removeAll()) 卻沒有任何問題 , 見圖:
?
其后通過查詢 removeAll 方法的源碼:(ext版本3.4.0) ,發(fā)現(xiàn)了這一句,
?
??????? if (silent !== true) {? //? prevents write-actions when we just want to clear a store.?????
?
this.fireEvent('clear', this, items); }
? 應(yīng)該就是store的緩存沒清的原因吧 ,下面是我的代碼部分:
/**
* 移出條目
*/
removeCurrentRec : function(){
var selections = this.grid.getSelectionModel().selections;
if (selections.length == 0) {
Ext.MessageBox.alert("提示", "請選擇一條的記錄!");
return ;
} else if (selections.length != 1) {
Ext.MessageBox.alert("提示", "不能多選");
return ;
}
this.grid.getStore().remove(selections.items[0]);
//添加此,否則,拖拽功能就會失去效果
this.grid.getStore().fireEvent('clear', this.grid.getStore(), selections.item[0]);
},
/**
* 移出所有條目
*/
removeAllRec : function(){
this.grid.getStore().removeAll();
},
???? 最終可以隨意刪除,隨意拖進(jìn)了,效果見圖:
???
??
?
?
?
?
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

