0
我正在使用ExtJS,当我删除网格中的一行时,我希望它自动刷新。但目前为止没有运气。 这是我的网格,并在年底的删除功能删除成功后的ExtJS刷新
Ext.define('CrudExt.view.usuario.Grid',{
extend: 'Ext.grid.Panel',
title : 'Lista brandova',
itemId : 'usuarioGrid',
xtype : 'usuariogrid',
store : 'Usuarios',
initComponent: function(){
this.columns = [
{ header: 'Sifra', dataIndex: 'sifra' },
{ header: 'Brand', dataIndex: 'brand'}
];
this.dockedItems = [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
text: 'Dodaj',
iconCls: 'add',
action: 'add'
},
{
text : 'Izbriši brand',
tooltip: 'Stisni za izbrisati brand.',
iconCls: 'delete',
itemId: 'delete',
scope: this,
handler: this.onDeleteClick
},
{
text: 'Izmjeni',
iconCls: 'edit',
action: 'edit'
}
]
},
{
xtype: 'pagingtoolbar',
store: 'Usuarios',
dock: 'bottom',
displayInfo: true
}
];
this.callParent(arguments);
},
onDeleteClick: function(grid){
Ext.Msg.show({
title:'Confirm Delete',
msg: 'Deleting this document will delete ALL users associated with this group.<br />ARE YOU SURE? Press "Yes" to delete.',
buttons: Ext.Msg.YESNO,
fn: processResult,
icon: Ext.MessageBox.WARNING,
scope: this
});
function processResult(buttonId){
if (buttonId == 'yes'){
var selection = this.getView().getSelectionModel().getSelection()[0];
var rev = selection.get('sifra');
Ext.Ajax.request
({
url : 'brand/delete/'+rev,
success : function(response)
{
}
});
//console.log(rev);
} else {
Ext.Msg.alert('The document has NOT been deleted');
}
};
}
});
我做了什么我tryed在delte成功添加以下行,没有他们的工作:
grid.getStore().load();
store.reload();
store.load();
store.sync();
this.getStore.load();
Ext.getCmp('usuarioGrid').getView().refresh();
grid.getView().refresh();
执行'store.reload()'时,您是否确实看到请求正在浏览器的调试器中发送到服务器? – 2015-03-25 13:20:53
不,不是。 现在我试过c/p刷新部分从创建和更新,通常在删除和删除文件时删除文件弹出“您删除了文档”。和store.reload()不做任何事情,它不在删除中。 – Kerempuhh 2015-03-26 08:35:00
最初如何加载商店? 'reload'使用最后一个'load'参数。 – 2015-03-26 13:54:48