Javascript-форум (https://javascript.ru/forum/)
-   ExtJS (https://javascript.ru/forum/extjs/)
-   -   Проблема с удалние в grideditor (https://javascript.ru/forum/extjs/12353-problema-s-udalnie-v-grideditor.html)

alexrzl 13.10.2010 17:42

Проблема с удалние в 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
    }

VKS 14.10.2010 09:21

{
text: 'Delete',
scope: this,
handler: function() {
var record = this.getSelectionModel().getSelected().data;
}

alexrzl 14.10.2010 11:47

Незнаю, почему, но функция getSelectionModel() работает, только если gridEditor объявлен так
var gridContact = new Ext.grid.EditorGridPanel({
    // код...
});

shukurove 16.10.2010 21:39

Грид создает по умольчанию Ext.grid.RowSelectionModel()
selModel: new Ext.grid.RowSelectionModel(),

можно это строку убрать если тебе нужен RowSelectionModel

alexrzl 19.10.2010 11:58

Спасибо, разобрался. Тему можно закрыть.


Часовой пояс GMT +3, время: 16:12.