0

我复制了这个例子,并定义了我的模型和商店。 http://cdn.sencha.com/ext-4.1.1a-gpl/examples/dd/dnd_grid_to_grid.html

          proxy:{
            type:'ajax',
            api:{
                create: '/msDx2PlaylistAudio/create',
                update: '/msDx2PlaylistAudio/create',
                destroy:'/msDx2PlaylistAudio/delete'
            },

            url:'/msDx2Playlist/loadData',

            reader:{
                type:'json',
                root:'data'
            }

如您所见,我将设置 api 创建、更新和销毁操作。但是当我拖放我的网格行时,我的商店只会破坏和加载动作。我不明白为什么商店不执行任何创建...在另一个我有一个网格自动同步的应用程序中工作正常。

4

2 回答 2

0

至少在 4.1.1 中,问题在于您拖动的记录phantom设置为 false。处理 drop 的代码如下所示,您将看到在将 drop recordsphantom标志插入新存储之前,无需将其设置为 true。

这似乎是一个错误。

Ext.define('Ext.grid.ViewDropZone', {
    extend: 'Ext.view.DropZone',

    handleNodeDrop : function(data, record, position) {
        var view = this.view,
            store = view.getStore(),
            index, records, i, len;

        // If the copy flag is set, create a copy of the models
        if (data.copy) {
            records = data.records;
            data.records = [];
            for (i = 0, len = records.length; i < len; i++) {
                data.records.push(records[i].copy());
            }
        } else {
            /*
             * Remove from the source store. We do this regardless of whether the store
             * is the same bacsue the store currently doesn't handle moving records
             * within the store. In the future it should be possible to do this.
             * Here was pass the isMove parameter if we're moving to the same view.
             */
            data.view.store.remove(data.records, data.view === view);
        }

        index = store.indexOf(record);

        // 'after', or undefined (meaning a drop at index -1 on an empty View)...
        if (position !== 'before') {
            index++;
        }
        store.insert(index, data.records);
        view.getSelectionModel().select(data.records);
    }
});
于 2013-02-26T12:24:40.783 回答
0

autoSync默认为 false,设置为 true。

var secondGridStore = Ext.create('Ext.data.Store', { model: 'DataObject' autoSync:true });

于 2012-12-10T22:54:54.010 回答