ExtJS拖放;“放弃给予”;类型错误:路径未定义";随手
我正在使用ExtJS 6.0.1,希望将项目从网格拖到树上,以便将一些类别值更改为网格记录 但在drop事件中,我得到了这个错误:“ExtJS拖放;“放弃给予”;类型错误:路径未定义";随手,extjs,Extjs,我正在使用ExtJS 6.0.1,希望将项目从网格拖到树上,以便将一些类别值更改为网格记录 但在drop事件中,我得到了这个错误:“TypeError:path未定义”。该错误由函数EnsureRevible从Ext.tree面板类的第一行返回 var foldersStore = Ext.create("Ext.data.TreeStore",{ storeId: 'foldersTreeStore', proxy
TypeError:path未定义”。该错误由函数EnsureRevible从Ext.tree面板
类的第一行返回
var foldersStore = Ext.create("Ext.data.TreeStore",{
storeId: 'foldersTreeStore',
proxy: {
type: 'ajax',
url: 'categories/tree.json'
},
autoLoad: true
});
var foldersTree = Ext.create("Ext.tree.Panel",{
title: 'Categories',
hideHeaders: true,
renderTo: 'folders-tree',
rootVisible: false,
allowDeselect: true,
store: foldersStore,
droppedRecords: undefined,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
dragText: 'Drag and drop to reorganize',
dropGroup: 'bkmDDGroup',
appendOnly: true
},
listeners: {
beforedrop: function(node, data, overModel, dropPos, opts) {
this.droppedRecords = data.records;
data.records = [];
console.log(this.droppedRecords);
},
drop: function(node, data, overModel, dropPos, opts) {
console.log(arguments);
}
}
}
});
var filesStore = Ext.create("Ext.data.Store",{
storeId:'filesTableStore',
fields:[
{name: 'eid', type:'string'},
{name: 'fileName', type:'string'},
{name: 'createdAt', type:'string'},
{name: 'mimeType', type:'string'},
{name: 'version', type:'string'},
{name: 'size', type:'int'},
{name: 'creator', type:'string'},
{name: 'modifier', type:'string'},
{name: 'status', type:'string'},
{name: 'tmpId'}
],
proxy: {
type: 'ajax',
url: 'documents/list.json',
reader: {
type: 'json',
rootProperty: "list"
}
},
autoLoad: true
});
var filesTable = Ext.create("Ext.grid.Panel",{
store: filesStore,
title:'Files',
selModel: {
mode: "MULTI",
allowDeselect: true
},
columns:[
{
text:'File Name',
flex:1,
dataIndex:'fileName'
},{
text:'Created By',
flex:1,
dataIndex:'creator'
},{
text:'Mime Type',
width: 150,
dataIndex:'mimeType'
},{
text:'Size',
width: 100,
dataIndex:'size'
},{
text:'Version',
width: 80,
dataIndex: 'version'
},{
text:'Status',
width: 100,
dataIndex:'status'
},{
text:'Created At',
width:150,
dataIndex:'createdAt'
}],
renderTo:'files-table',
height:UI.getContentHeight("#files-table"),
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
dragText: 'Drag and drop to reorganize',
dragGroup: 'bkmDDGroup'
}
}
});
从我的角度看,我似乎忘记了一些配置,仍然没有任何想法。即使在drop事件中只有一行console.log,错误也会保持不变
任何线索都将不胜感激。
感谢您在beforedrop侦听器中删除所选记录:
data.records = []
相反,您必须准备好将这些记录放入数据模型与网格不同的树面板中
为了实现请提供一个问题,这里是我的问题:恐怕您的示例在ExtJS6中不起作用。该示例使用的是版本4。是的,我正在删除记录,否则它们将从网格中删除。我还想将它们从列表中删除,但只有在成功调用ajax之后,它才能在DB中更改这些文件(网格元素)的类别(树元素)。我已删除beforedrop和drop事件中的所有内容,错误仍然存在。我记得,我正在使用版本6.0.1.Try属性。然后,您可以根据需要从源网格中删除记录。删除data.records=[]
并将copy:true
属性添加到gridviewdragdrop
插件