0
在Sencha Architect上使用ExtJs4.1。使用CheckboxSelectionModel從網格刪除多個項目
我在onDeleteButton代碼下面的代碼
onDeleteButtonClick: function(button, e, options) {
var active = this.activeRecord;
var myGrid = Ext.getCmp('publisherResultsGridView'),
sm = myGrid.getSelectionModel(),
selection = sm.getSelection(); // gives you a array of records(models)
if (selection.length > 0){
for(var i = 0; i < selection.length; i++) {
this.application.log('OnDeleteItemID is ' + selection);
}
this.remove(selection);
}
代碼Remove
功能
remove: function(record) {
var store = Ext.getStore('PublisherProperties');
store.proxy.url = MasterDataManager.globals.url + "Publishers/";
store.remove(record);
store.sync();
當我運行它,我可以看到對象的數組在我的日誌,我也沒得到執行remove函數後的任何錯誤。但商店不更新,我的意思是它不刪除選定的項目。
有人可以幫我。
感謝
你能後是如何被創建存儲。這聽起來像設置代理API有問題。 http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Server-cfg-api。或者,getStore中的商店可能是錯誤的。每個記錄都有一個存儲屬性,這將是不使用硬編碼ID獲取引用的首選方式。 – pllee