我試圖刪除一些數組的記錄來顯示它,但是當我刪除記錄時,什麼都不刪除。如何從js中的數組中刪除記錄
Ext.onReady(function() {
Ext.create('BVCore.Grid', {
id:'gridServiceCatalogAll',
renderTo: 'gridServiceCatalogAll',
stateId: 'gridServiceCatalogAll',
store: Ext.create('BVCore.LocalStore', {
fields: ['id','category', 'name', 'equipment', 'sizeMin', 'sizeMax', 'description', 'annualCharge'],
groupers:[grouper],
proxy: {
url: '<spring:url value="/controller/search/json/serviceCatAll.json" />'
},
listeners:{
load: function(store, records) {
Ext.each(records, function(record, index){
Ext.each(records, function(rec, ind){
if((record.get('category') == rec.get('category')) && (record.get('annualCharge') == rec.get('annualCharge')) && (record.get('id') != rec.get('id'))){
store.remove(rec);
}
}, this);
}, this);
}
}
}),
features: [{ftype:'grouping'}],
columns: [
{text: '<spring:message code="serviceModel.category" />', dataIndex: 'category'},
{text: '<spring:message code="serviceModel.description" />', dataIndex: 'description'},
{text: '<spring:message code="serviceModel.annualCharge" arguments="${year}" />', dataIndex: 'annualCharge'}
]
});
});
有人有什麼想法嗎?
在什麼時候,你顯示它?你能發佈完整的代碼嗎? – atmd 2015-02-06 14:39:04
@atmd我編輯我的帖子 – 2015-02-06 14:42:14