在Ext 4.1中,我将项目放到网格中,但是记录带有一个id,并且幻像标志设置为false,导致存储空白并且不将这些记录添加到它。即使它们在网格上显得很好。
我在线阅读了几个解决方案,很多人建议将幻像标志设置为false和/或将id设置为null,但是我无法实现这个?我在哪里设置它?
以下是相关链接:
我尝试在viewConfig上添加一个beforedrop
侦听器并在那里更改幻像标志和id,但这不起作用。有什么帮助吗?
答案 0 :(得分:1)
我有它的工作。试试这个:
// BUGFIX - when records are copied between grids, the copied record don't get its phantom set
// to true, thus, no Create call will be made to the server.
Ext.override( Ext.data.Model, {
copy : function(newId) {
var iNewRecord = this.callParent( arguments );
iNewRecord.phantom = true;
return iNewRecord;
}
});
我的源表也将视图config copy
设置为true,尽管在撰写本文时我不知道为什么或者这是否有效:
Ext.define('BS.view.items.Items' ,
{
extend: 'BS.tree.Panel',
...
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
dragGroup: 'classrooms',
},
// notice this
copy: true
},
});