PDA

View Full Version : Grid and restful store: no delete requests



biohazardo
21 Feb 2012, 5:19 AM
I have a grid. Want to delete items with REST proxy. Grid can read data from server, but doesn't any delete requests there. Everything, like in ExtJS4 examples
Here is grid's store and proxy code inside grid code (in InitComponent() ):


this.store = Ext.create('Ext.data.Store', {
autoSync: true,




model:this.model,


addCondition:function (key, value) {
this.proxy.extraParams[key] = value;
return this;
},
sorters:[
{
property:'NAME',
direction:'ASC'
}
],
proxy:{
type:'rest',
extraParams:{
model:this.model
},
url:document.head.baseURI + 'rest',


reader:{type:'json',root:'data'},
writer:{type:'json',root:'data'}


},
initComponent:function(){
this.model.proxy = this.proxy;
}
});

Store doesn't make any delete request at all. Firebug console is empty. And here is event, that calling removing method of store:


if (btn=='yes'){
var selection = clientgrid.getView().getSelectionModel().getSelection()[0];
clientgrid.store.remove(selection);
}

This action removes one record from local data, but after data refresh from server, this record is still there. What can help me?

mitchellsimoens
21 Feb 2012, 6:31 AM
A store doesn't have an initComponent method as it's not a component.

biohazardo
21 Feb 2012, 10:14 PM
A store doesn't have an initComponent method as it's not a component.

Dragged initComponent code to another place. Same problem.

I tried many options of this grid, tried ajax proxy, rest proxy, change urls, api, readers and writers and other. But there is no delete request at all.

If i call store.save() there is a request to my link... But I need it on create, delete and update actions, not on save...

chramer
22 Feb 2012, 2:27 AM
do you have the "idProperty" for the model ?

biohazardo
24 Feb 2012, 2:36 AM
idPropery doesn't help.

andrekpl
10 Mar 2012, 12:43 AM
I encountered the same issue.
selection.destroy() does the work.

dedoz
10 Mar 2012, 7:15 PM
clientgrid.store.remove(selection);
this wont trigger a delete to the server
store requests are triggered after doing a .load() or a .sync()
u need to remove the record from the store with store.remove(someRecord or records)
this onlye marks them as deleted but i didnt tell the server to delete them yet

then you have to do a store.sync() this will actually tell to the server which records are been created, which been modified, and which been deleted.