我想要一个在删除任何行并检索具有相同成员 ID 的行后将更改或重新加载的网格。为此,我添加了过滤器。在删除任何行后,我再次使用过滤器回调存储。我的商店过滤得很好,但网格无法显示它......它保留了以前的显示......
Ext.define('${pkgName}.v02x001001.SV02X00100101' , {
extend : 'Ext.grid.Panel',
alias : 'widget.sv02x00100101',
id : 'sv02x00100101',
border : true,
modal : true,
height : 300,
width : 455,
viewConfig: {
stripeRows : true,
forceFit : true,
emptyText : 'No Records to display',
listeners : {
viewready : function(v) {
var store = Ext.data.StoreManager.get('S02X001001');
store = !store ? Ext.create("S02X001001") : store;
var value = Ext.getCmp('member-sv02x00100104').getValue(),
filters = new Array();
store.clearFilter();
store.filter('member', value);
filters.push({
property : 'member',
value : value
});
store.loadPage(1, {
filters : filters
});
}
}
},
initComponent: function() {
this.store = 'S02X001001';
this.tbar= Ext.create('Ext.ux.StatusBar', {
topBorder : false,
statusAlign : 'right',
items : [{
xtype :'button',
text : 'ADD',
icon : "${resource(dir: 'images', file: 'ADD01003.png')}",
listeners : {
click : this.onNewAddress
}
},'-']
});
this.columns = [
{
text : 'Address Line 1',
dataIndex : 'addressline1',
sortable : false,
flex : 1
},{
text : 'Address Line 2',
dataIndex : 'addressline2',
sortable : false,
width : 170
},{
menuDisabled : true,
sortable : false,
id : 'deletee',
xtype : 'actioncolumn',
width : 22,
items : [{
icon : "${resource(dir: 'images', file: 'DEL01005.png')}",
tooltip : 'Delete This?',
scope : this,
handler : function(grid, rowIdx, colIdx) {
var record = grid.getStore().getAt(rowIdx);
var conId = record.data.id
this.onDeleteClick(conId);
}
}]
}];
this.callParent(arguments);
},
onNewAddress: function(btn, e, eOpts){
var view=Ext.widget('sv02x00100102');
view.show();
var a = Ext.getCmp('member-sv02x00100104').getValue();
Ext.getCmp('member-sv02x00100102').setValue(a);
},
onDeleteClick:function(conId){
Ext.MessageBox.show({
title : 'Delete',
msg : 'Really want to delete ?',
icon : Ext.Msg.WARNING,
buttons : Ext.MessageBox.YESNO,
buttonText :{
yes: "Delete",
no : "No"
},
scope : this,
animateTarget : 'deletee',
fn: function(btn, dbQty){
if(btn == 'yes'){
var registration = Ext.create('${appName}.model.M02X001001',{
id : conId
});
var store = this.getStore();
registration.destroy({
scope : this,
success : function(model, operation) {
if(model != null){
var store = Ext.data.StoreManager.get('S02X001001');
store = !store ? Ext.create("S02X001001") : store;
var value = Ext.getCmp('member-sv02x00100104').getValue(),
filters = new Array();
store.clearFilter();
store.filter('member', value);
filters.push({
property : 'member',
value : value
});
store.loadPage(1, {
filters : filters
});
}
},
failure: function(){
console.log('Unable to delete');
}
});
}
}
});
}
});
如何检索其余的相关行........
这是我的商店............
Ext.define('${pkgName}.S02X001001', {
extend : 'Ext.data.Store',
model : '${appName}.model.M02X001001',
idProperty: 'id',
autoLoad : true,
autoSync : true,
filterParam: 'query',
remoteSort: true,
proxy : {
type : 'ajax',
noCache : false,
limitParam: 'limit',
startParam: 'start',
url : '${createLink(controller:'C02x001001', action: 'store')}',
reader:{
type : 'json',
root : 'data',
totalProperty : 'total',
successProperty : 'success',
messageProperty : 'message',
implicitIncludes: true
},
simpleSortMode : true
},
sorters: [{
property: 'id',
direction: 'asc'
}]
});