0
我在我的視圖上創建了兩個網格。這兩個網格將能夠將物品從彼此以及自己拖放。另外,這些網格必須是可編輯的。我使用rowediting插件來編輯網格,但我總是得到錯誤「Uncaught TypeError:無法調用未定義的方法'getSelectionModel'」。沒有插件的網格工作正常,我沒有得到任何錯誤。問題是什麼?有人可以指出嗎?我的網格的代碼是:無法編輯ExtJS網格數據
Ext.define('DHT.view.Configuration.CategoriesConfig', {
extend: 'Ext.panel.Panel',
requires: ['DHT.model.Category','Ext.grid.*'],
alias: 'widget.categoriesconfig',
layout: {
type: 'hbox',
align: 'stretch'
},
floating: true,
closable: true,
modal: true,
height: 500,
width: 800,
title: 'Question Categories',
items: [{
xtype: 'grid',
title: 'Invisible',
width: '47%',
selType: 'rowmodel',
viewConfig: {
plugins: [{
ptype :'rowediting',
clicksToEdit: 2
},{
ptype: 'gridviewdragdrop',
dragGroup: 'invisible',
dropGroup: 'visible'
}, {
ptype: 'gridviewdragdrop',
dragGroup: 'invisible',
dropGroup: 'invisible'
}]
},
store: {
model: 'DHT.model.Category',
data: [
{ 'QuestionTypeID': 1, 'Description': 'A', 'SortOrder': 1 },
{ 'QuestionTypeID': 2, 'Description': 'B', 'SortOrder': 2 },
{ 'QuestionTypeID': 3, 'Description': 'C', 'SortOrder': 3 },
{ 'QuestionTypeID': 4, 'Description': 'D', 'SortOrder': 4 }
]
},
columns: [{
xtype: 'actioncolumn',
id: 'deleteButton',
width: '5%',
align: 'center',
items: [{
icon: 'Images/delete.png', tooltip: 'Delete'
}]},
{
header: 'Order',
dataIndex: 'SortOrder',
width: '34%',
sortable: false,
menuDisabled: true
},
{
header: 'Description',
editable: true,
editor: {
xtype: 'textfield',
allowBlank: false
},
dataIndex: 'Description',
width: '58%',
sortable: false,
menuDisabled: true
}]
},
{
xtype: 'panel',
title: '',
width: '6%',
title: ' '
},
{
xtype: 'grid',
title: 'Visible',
selType: 'rowmodel',
width: '47%',
viewConfig: {
plugins: [{
ptype :'rowediting',
clicksToEdit: 2
},{
ptype: 'gridviewdragdrop',
dragGroup: 'visible',
dropGroup: 'invisible'
}, {
ptype: 'gridviewdragdrop',
dragGroup: 'visible',
dropGroup: 'visible'
}]
},
store: {
model: 'DHT.model.Category',
data: [
{ 'QuestionTypeID': 5, 'Description': 'E', 'SortOrder': 1 },
{ 'QuestionTypeID': 6, 'Description': 'F', 'SortOrder': 2 },
{ 'QuestionTypeID': 7, 'Description': 'G', 'SortOrder': 3 },
{ 'QuestionTypeID': 8, 'Description': 'H', 'SortOrder': 4 }
]
},
columns: [{
xtype: 'actioncolumn',
id: 'deleteButton',
width: '5%',
align: 'center',
items: [{
icon: 'Images/delete.png', tooltip: 'Delete'
}]},
{
header: 'Order',
dataIndex: 'SortOrder',
width: '34%',
sortable: false,
menuDisabled: true
},
{
header: 'Description',
editable: true,
editor: {
xtype: 'textfield',
allowBlank: false
},
dataIndex: 'Description',
width: '58%',
sortable: false,
menuDisabled: true
}]
}]
});
我的模型:
Ext.define('DHT.model.Category', {
extend: 'Ext.data.Model',
fields: [
{
name: 'QuestionTypeID',
dataType: 'int'
},
{
name: 'Description',
dataType: 'string'
},
{
name: 'SortOrder',
dataType: 'int'
}
],
idProperty: 'QuestionTypeID'
});
是的,先生。同樣的結果。 – user1640256