Hi,

I'm trying to implement my own proxy. But I have some problems now.
Everytime my create function is called, everything works well (data gets saved). But the operations are saved too! This means, that the create operation is still there and every following record to create is saved to this operation and gets recreated during the next call. After a few cycles, I have several records in the create operation of the batch.

My create function looks like this:

Code:
create: function(operation, callback, scope) {
    if (!this._dbInitialized) {
        this.initDataBase();
    }

    var me = this;

    var records = operation.getRecords(),
        length = records.length,
        record,
        i;

    operation.setStarted();

    for (i = 0; i < length; i++) {
        record = records[i];
        me.setRecord(record);
    }

    operation.setCompleted();
    operation.setSuccessful();

    if (typeof callback == 'function') {
        callback.call(scope || me, operation);
    }
},
So the problem is now, that the created records are still present in the create batch/operation.
I found the following in the Ext.data.Store:

Code:
...
// These methods are now just template methods since updating the records etc is all taken care of
// by the operation itself.
onCreateRecords: function(records, operation, success) {},
onUpdateRecords: function(records, operation, success) {},
...
These functions are called in onProxyWrite().
Do I have to override these functions and remove the records by hand? Or what else do I have to do?

At the moment it is very hard to write a custom proxy for ST2. Do you think, you can write some docu for this?

Thx,
Alex

UPDATE:

Ok, I think the problem is in the sync() function, where getNewRecords() is called, which filters records by the phantom flag:

Code:
sync: function() {
    var me = this,
        operations = {},
        toCreate = me.getNewRecords(),
...
I saw in the debugger, that the added records have still the phantom flag set to true.
Do I have to set this to false by hand? Where? Directly after I saved the record (me.setRecord()) or where is the best location for this?