PDA

View Full Version : store.sync() doesnt add action=create or action=delete.....parameters



neo1010
19 Oct 2014, 1:16 PM
Hy,


I am using a GridPanel and when I delete or update or create a Model in the grid , when I call sync in the store it makes always a post request with the updated or deleted or created models but I dont see any parameters which distinguish the ones which have to be updated or deleted .....

1. am I missing something?
2. I am using an Ajax proxy
3. When I add a model to the store, I dont see the red marks that indicate the record is dirty and when I update them I do, why?


Thanks

slemmon
19 Oct 2014, 9:49 PM
To make sure we're on the same page can you share a test case that demonstrates your setup? You can do so here or at https://fiddle.sencha.com

neo1010
20 Oct 2014, 1:49 AM
Hy,

This is my store and my proxy



Ext.define('Demo.store.Users',{
extend : 'Ext.data.Store',
storeId : "storeUsuarios",
autoLoad : true,
proxy : {
type : "ajax",
url : "app/data/usuarios.json",
reader : {
type: "json",
root : "usuarios"
}

},
model: 'Demo.model.User'
});

And the call I am making is just store.sync() without passing any configuration and it does a post request but I cant see any parameters.

1. What kind of parameters should I see?

Thanks

fennecFox
20 Oct 2014, 8:56 AM
I think you might need to turn off the 'batchActions' on the proxy if I understood your question properly. Then the corresponding HTTP actions will be used for your CRUD operations.

neo1010
20 Oct 2014, 1:49 PM
Hy,

I want to add parameters to distinguish the delete operations from the updated operations but I dont see these parameters, just post requests without any parameters. I have tried with batchActions = false but batchActions is true bye default so it should be true to get the results I want and not false, right? batch implies just one request with the records to create, update, etc....?

Thanks

slemmon
23 Oct 2014, 9:30 PM
Different params aren't sent by default when only a single URL config is used. I'd recommend using the api (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.proxy.Ajax-cfg-api) config instead so that you can specify unique URLs - or a single URL with different params for each action.