Проблема с удалние в grideditor
При попытке удалить запись происходит следующая ошибка: Ошибка: gridContact.getSelectionModel is not a function. На официальном форума говорят, необходимо подкулючать модуль.
http://www.sencha.com/forum/archive/...hp/t-3579.html selModel: new Ext.grid.RowSelectionModel() Не помогает. Исходник:
var gridContact = {
xtype: 'editorgrid',
store: contactStore,
selModel: new Ext.grid.RowSelectionModel(),
columns: [
{ header: 'ID', dataIndex: 'id', hidden: true },
{ header: 'Контакт', dataIndex: 'value', width: 150, editor: nameInfo },
{ header: 'Тип', dataIndex: 'type', editor: nameType }
],
height: 175,
clicksToEdit: 2,
//loadMask: true,
tbar: {
items: [
{
text: 'Save Change',
handler: function() {
contactStore.save();
contactStore.commitChanges();
contactStore.reload();
}
}, {
text: 'Add',
handler: function() {
var u = new contactStore.recordType({
value: 'user@execute.com',
type : '2'
});
contactStore.insert(0, u);
}
}, {
text: 'Delete',
handler: function() {
var sm = gridContact.getSelectionModel();
}
}
]
}
//batchSave: false
}
|
{
text: 'Delete', scope: this, handler: function() { var record = this.getSelectionModel().getSelected().data; } |
Незнаю, почему, но функция getSelectionModel() работает, только если gridEditor объявлен так
var gridContact = new Ext.grid.EditorGridPanel({
// код...
});
|
Грид создает по умольчанию Ext.grid.RowSelectionModel()
selModel: new Ext.grid.RowSelectionModel(), можно это строку убрать если тебе нужен RowSelectionModel |
Спасибо, разобрался. Тему можно закрыть.
|
| Часовой пояс GMT +3, время: 02:35. |