我正在尝试删除某些数组的记录以显示它,但是当我删除记录时,没有任何内容被删除。
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'}
]
});
});
有人有任何想法吗?
答案 0 :(得分:0)
好像你想删除一个对象的属性,
这是你如何做到的。
var obj = {'foo':'bar'}
delete obj.foo
console.log(obj); //Object {}
答案 1 :(得分:0)
对于数组使用splice:splice