0

私はこのようなモデルを持っています:

Ext.define('Policy', {
    extend: 'Ext.data.Model',

    fields: [
        {
            name: 'id',
            type: 'sting',
            phantom: true,
            convert: function(value, record) {
                return record.get('a') + '@' +
                    record.get('b');
            }
        },
        {name: 'a', type: 'string'},
        {name: 'b', type: 'string'}]
});

各レコードの PK はabです。店内はこんな感じ。

Ext.define('Store', {
    extend: 'Ext.data.Store',
    model: 'Policy', 
    autoLoad: true,

    proxy: {
        type: 'rest',
        simpleSortMode: true,
        batchActions: true,
        reader: {
            type: 'json',
            root: 'data',
            idProperty: 'id'
        },
        writer: {
            nameProperty: 'mapping'
        },
        api: {
            create:'/batch',
            read: '/policies',
            update: '/batch',
            destroy: '/batch'
        }
    }
});

store.sync()呼び出し時に /batch に POSTS するときに、ペイロードが次のようになり、ダーティ レコードのみで構成されるようにストアを構成するにはどうすればよいですか

{
    "policies": [{
        "a": "AA",
        "b": "BB",
    }, {
        "a": "AAA",
        "b": "BBB"
    },...]
}

プロパティがあり、policiesその下に一連のダーティ ポリシーがあります。

4

1 に答える 1

0

Ext.Ajax()手動呼び出しを行うことで、必要な構造を作成できます。ダーティ レコードのみを自分で提出する必要があります。

于 2013-06-28T13:08:11.240 に答える