首页 > 解决方案 > Modern Toolkit- Grid with Multiselection:如何在网格行选择上勾选多个复选框。?

问题描述

在现代多选网格中,只有当我单击复选框时才会选中多个复选框。但我希望在网格行选择上勾选多个复选框。任何人都可以请建议。

标签: extjsgridextjs6-modern

解决方案


在以下示例中,选择是通过点击行产生的:

var grid = Ext.create('Ext.grid.Grid', {
    title: 'Streaming Service Providers',
    columns: [{
        text: "Brand",
        dataIndex: "brand",
        flex: 1
    }, {
        text: "Headquarters",
        dataIndex: "headquarters",
        flex: 1
    }, {
        text: "Trial",
        dataIndex: "trial",
        flex: 1
    }, {
        text: "Price",
        flex: 1,
        dataIndex: 'price'
    }],
    store: {
        fields: ['brand', 'headquarters', 'trial', 'price'],
        data: [{
            brand: 'Netflix',
            headquarters: 'California',
            trial: '1 Month',
            price: '$7.99'
        }, {
            brand: 'YouTube',
            headquarters: 'California',
            trial: '1 Month',
            price: '$9.99'
        }, {
            brand: 'Amazon Prime',
            headquarters: 'Seattle, Washington',
            trial: '1 Month',
            price: '$8.25'
        }],
        storeId: 'serviceStore'
    },
    height: 400,
    renderTo: Ext.getBody(),
    // Row checkbox selection model config
    selectable: {
        columns: false,
        mode: 'multi',
        checkbox: true,
        cells: false,
        rows: true,
    }
});

推荐阅读