多行 select ExtJS

Multiple row select ExtJS

我有带 RowSelectionModel 的网格:

selModel: {
    selType: 'rowmodel',
    mode: 'MULTI'
}

如何在网格中select多行?现在我只能 select 一条记录 me.getViewModel().get('record'):

var me = this;

// Ask user to confirm this action
Ext.Msg.confirm('Confirm Delete', 'Are you sure you want to delete this asset_objects?', function(result) {

    // User confirmed yes
    if (result == 'yes') {

        var record = me.getViewModel().get('record'),
            store = Ext.StoreManager.lookup('asset_objects');

        // Delete record from store
        store.remove(record);

        // Sync remote store
        store.sync();

        // Hide display
        me.showView('selectMessage');

    }

});

我如何将 selected 记录绑定到 viewModel:

select: function(rowmodel, record, index, eOpts) {
    // Set selected record
    this.getViewModel().set('record', record);

    // Show details
    this.showView('details');
}

你可以像这样使用Ext.selection.RowModel.getSelection()

select: function (rowmodel, record, index, eOpts) {
    this.getViewModel().set('record', rowmodel.getSelection());

}

或者代替 select ( this, record, index, eOpts ) event, where record is last selected record, you can use selectionchange ( this, selected, eOpts ) 事件,其中 selected 是所有 selected 记录。

请记住,当您 select 和 deselect 记录和值时,会触发 selectionchange 事件可以是一个空数组。