Tariq
Tariq

Reputation: 2871

dgrid selection- select row only when I click on check box

I have a dgrid with selection extention.
how can I be able to select any row without checking the box.
I mean, I can check to check box only if I click on it directly.

Upvotes: 0

Views: 1308

Answers (1)

Ken Franqueiro
Ken Franqueiro

Reputation: 10559

The wording in your question's description sounds a little bit off from your question's title, but I think what you're asking is how to allow selecting rows only via a checkbox in a selector column. You can do this with a combination of the Selection mixin with selectionMode: 'none' and a column using the selector column plugin. Here's a rough example:

require([
    'dojo/_base/declare',
    'dgrid/Grid',
    'dgrid/Selection',
    'dgrid/selector'
], function (declare, Grid, Selection, selector) {
    var SelectionGrid = declare([Grid, Selection]);
    var grid = new SelectionGrid({
        columns: {
            selector: selector({ label: '' }),
            // other columns here...
        },
        selectionMode: 'none'
    });
    // Place, startup the grid, and add data here...
});

You can see examples like this in dgrid's test/selector.html page.

Upvotes: 3

Related Questions