Hello All,

I seem to have some trouble understanding the way DirectStore.Api.save maps its request data. Looking at firefox when some record in the store gets saved the request takes on the following format (json):

Code:
{
  "action":"employee",
  "method":"update",
  "data":[
     "115",
     {"name":"Employee 121sss","id":"115"}],"type":"rpc",
  "tid":3
}
Is the data property intentionally an array with both scalars ánd objects? Why does it put the ID separate from the rest of the data (even with API methods that have a len of 1) - in other words, why supply two sets of parameters to the server when there's only one parameter that is expected by the server?

Then if this is intentionally then how to expect the router (and/or the client) to know to go to the second set of data to get all of the neccesary parameters

the following code will reproduce the scenario:
HTML Code:
Ext.onReady(function(){

    Ext.Direct.addProvider(Ext.app.EXT_API);

    //reader
    var reader = new Ext.data.JsonReader({
        totalProperty: 'total',
        successProperty: 'success',
        idProperty: 'id',
        root: 'data'
    }, [
        { name: 'id', type: 'int'},
        { name: 'name',type: 'string'},
        { name: 'email', type: 'string' },
        { name: 'salary', type: 'float'},
        { name: 'active', type: 'boolean'},
        { name: 'created_at', type: 'date', dateFormat: 'Y-m-d H:i:s'}
    ]);

    //writer
    var writer = new Ext.data.JsonWriter({
        returnJson: false,
        writeAllFields: false
    })

    //Direct Store
    var store = new Ext.data.DirectStore({
        storeId:'employee-store',
        api: {
          load: employee.load,
          save: employee.update
        },
        sortInfo: {
            field: 'created_at',
            direction: 'DESC'
        },
        remoteSort: true,
        paramsAsHash: true,
        autoLoad : true,
        reader: reader,
        writer: writer
    });

    //grid
    var grid = new Ext.grid.EditorGridPanel({
        store: store,
        width: 600,
        region:'center',
        margins: '0 5 5 5',
        autoExpandColumn: 'name',
        loadMask: true,
        columns: [{
            id: 'name',
            header: 'name',
            dataIndex: 'name',
            width: 220,
            sortable: true,
            editor: {
                xtype: 'textfield',
                allowBlank: false
            }
        },{
            header: 'Email',
            dataIndex: 'email',
            width: 150,
            sortable: true,
            editor: {
                xtype: 'textfield',
                allowBlank: false,
                vtype: 'email'
            }
        },{
            xtype: 'datecolumn',
            header: 'Start Date',
            dataIndex: 'created_at',
            format: 'm/d/Y',
            width: 100,
            sortable: true,
            groupRenderer: Ext.util.Format.dateRenderer('M y'),
            editor: {
                xtype: 'datefield',
                allowBlank: false,
                minValue: '01/01/2006',
                minText: 'Can\'t have a start date before the company existed!',
                maxValue: (new Date()).format('m/d/Y')
            }
        },{
            xtype: 'numbercolumn',
            header: 'Salary',
            dataIndex: 'salary',
            format: '$0,0.00',
            width: 100,
            sortable: true,
            editor: {
                xtype: 'numberfield',
                allowBlank: false,
                minValue: 1,
                maxValue: 150000
            }
        },{
            xtype: 'booleancolumn',
            header: 'Active',
            dataIndex: 'active',
            align: 'center',
            width: 50,
            trueText: 'Yes',
            falseText: 'No',
            editor: {
                xtype: 'checkbox'
            }
        }],
        bbar: new Ext.PagingToolbar({
            pageSize: 25,
            store: store,
            displayInfo: true,
            displayMsg: 'Displaying topics {0} - {1} of {2}',
            emptyMsg: "No topics to display"
        })
    });

    //Layout
    var layout = new Ext.Panel({
        title: 'Employees',
        layout: 'border',
        layoutConfig: {
            columns: 1
        },
        width:600,
        height: 600,
        items: [grid]
    });
    layout.render(Ext.getBody());

});
Kind Regards

Ad