PDA

View Full Version : Record not deleted from Grid.Store.Proxy.Reader



swiji2000
23 Jun 2013, 9:19 PM
Hi,

I deleted one record from my grid. after deleting a record , grid.store.data shows the records except deleted record.

but grid.store.proxy.reader showing all records with deleted also. how can i remove record from proxy reader or how to refresh proxy reader?

here is my code:



xtype:'gridpanel',
title:'Data Grid',
id:'gridId',
store : Ext.create('Ext.data.Store', {
fields : ['name', 'email', 'phone'],
data:[
{"name":"Lisa", "email":"lisa@simpsons.com", "phone":"555-111-1224"},
{"name":"Bart", "email":"bart@simpsons.com", "phone":"555--222-1234"},
{"name":"Homer", "email":"home@simpsons.com", "phone":"555-222-1244"},
{"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
],
}),
columns: [
{header: 'Name', dataIndex: 'name'},
{header: 'Email', dataIndex: 'email', flex:1},
{header: 'Phone', dataIndex: 'phone'},
{
xtype : 'actioncolumn',
flex : .2,


id : 'delete',
align : 'center',
items : [{
icon : 'resources/images/icons/delete16.gif',
tooltip : 'Delete'
}],
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
Ext.getCmp('gridId').getStore().remove(rec);
Ext.getCmp('gridId').getStore().sync();
Ext.getCmp('gridId').getView().refresh();
}


}
],
height: 200,
width: 400,
renderTo: Ext.getBody()



Thanks in advance.

swiji2000
24 Jun 2013, 2:31 AM
Hi,

Deleted record not updated in to Store.proxy.data, but store.data is updated.

Please help me to resolve the issue.

Thanks in advance.

Farish
24 Jun 2013, 5:55 AM
sync()ing your store doesnt refresh it?

swiji2000
25 Jun 2013, 1:14 AM
its not refresh after sync()

swiji2000
25 Jun 2013, 1:16 AM
I fount some solution for that.

Ext.encode(Ext.pluck(Ext.getCmp('gridId').getStore().tree.root.childNodes[0].store.data.items,'data'))

it is working fine. i am getting latest data as json format after delete a row.

Thanks