View Full Version : removeAll(true) calling destroy api

26 Mar 2010, 5:39 AM
I have a a direct store setup:

Ihc.app.DirectProxy = new Ext.data.HttpProxy({

Ihc.app.DirectWriter = new Ext.data.JsonWriter({

Ihc.app.reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'orderItemID',
root: 'data',
messageProperty: 'message'
}, [
{name: 'orderItemID'},
{name: 'item'},
{name: 'itemID'},
{name: 'size'},
{name: 'quantity'},
{name: 'categoryID'},
{name: 'comment'},

Ihc.app.dsOrder = new Ext.data.Store({
exception : function(){
//Ihc.app.dsOrder.baseParams.orderID = null;

When I call Ihc.app.dsOrder.removeAll(true) my destroy api call is getting fired. Other then taking of autoSave true is there another way around this? I thought the true flag was supposed to suppress the destroy call?

26 Mar 2010, 5:49 AM
As a work around I have set autoSave:false, and I am calling the save() method when I want to update the backend.

26 Mar 2010, 11:37 AM
After continuing to play with this particular setup I started finding some other odd things.

1. When I would start a new order, and clear out the items in the store using removeAll, I would some times get an exception when trying to add a new item to the empty store. I would see a destroy call go out(even though I did not call it!!!) with the old record ids that were removed( I could see they were not in data.items) go out in the call.

2. I would also at times see the wrong item values get inserted. I could see the new items info go out in the create call, and see them come back in the response, but then the value would revert to that which was in the store before my removeAll call.

All of these issues really had me thinking I was not going to be able to use the direct writer for this control. Then I got a suggestion from Lloyd in the ext IRC chat to destroy the store, and start over, instead of removing the old records.

This suggestion fixed my problem, and allowed me to utilize the writer, and direct store with my grid. I'm not sure if this is the intent of the store, that it should be destroyed, but it is what I needed to do in my use case.

I hope this helps some one.

28 Mar 2012, 4:53 AM
I can't stop it at all with 4.1.0-rc1, well, at least can't find a reference to autoSave anywhere in the Ext codebase.

Going to override the destroy method I think, since I only have to support reading.

28 Mar 2012, 6:15 AM
Sorted it, with some code that feels very filthy.

In my TreeNode model class:

proxy: {
type: 'ajax',
* This gets called when we call removeChild with destroy set to true, and by default it tries to
* sync with the server, which is not what we want.
* This version simply removes the record from the store and calls the callback.
* @param {[type]} operation The operation being performed.
* @param {Function} callback The callbakc function.
* @param {[type]} scope The scope in which to call the callback
destroy: function(operation, callback, scope) {
if (operation) {
Ext.Array.each(operation.records, function(record) {
if (record) {
Ext.Array.each(record.stores, function(store) {

Ext.callback(callback, scope, [operation]);


Can't help but think buildRequest should not throw an exception if you have no url for destroy though... feel like I'm being forced to dodge something that I should be able to tell the framework I do not support.


30 Apr 2012, 12:26 AM
This spam is getting more cryptic =D>