Api extjs网格dnd插件不会创造价值
我复制了这个示例,并定义了我的模型和存储。 如您所见,我将设置api创建、更新和销毁操作。但当我拖放网格行时,我的存储只执行销毁和加载操作。我不明白为什么商店不执行任何创建。。。在另一个我有一个网格的应用程序中,自动同步工作正常。默认为false,将其设置为true var secondGridStore=Ext.create('Ext.data.Store'{ 模型:“数据对象” 自动同步:真Api extjs网格dnd插件不会创造价值,api,extjs,extjs4,store,drag-and-drop,Api,Extjs,Extjs4,Store,Drag And Drop,我复制了这个示例,并定义了我的模型和存储。 如您所见,我将设置api创建、更新和销毁操作。但当我拖放网格行时,我的存储只执行销毁和加载操作。我不明白为什么商店不执行任何创建。。。在另一个我有一个网格的应用程序中,自动同步工作正常。默认为false,将其设置为true var secondGridStore=Ext.create('Ext.data.Store'{ 模型:“数据对象” 自动同步:真 }); 至少在4.1.1中,问题是您正在拖动的记录的幻影设置为false。处理该删除的代码如下所示
}); 至少在4.1.1中,问题是您正在拖动的记录的
幻影设置为false。处理该删除的代码如下所示,您将看到,在将丢弃的记录插入到新存储之前,没有任何东西可以将丢弃的记录设置为true
这似乎是一个bug
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);
}
});
Ext.define('Ext.grid.ViewDropZone'{
扩展:“Ext.view.DropZone”,
handleNodeDrop:功能(数据、记录、位置){
var view=this.view,
store=view.getStore(),
索引,记录,i,len;
//如果设置了复制标志,请创建模型的副本
if(data.copy){
记录=数据记录;
data.records=[];
对于(i=0,len=records.length;i
我将其设置为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);
}
});