react-redux-grid icon indicating copy to clipboard operation
react-redux-grid copied to clipboard

selection plugin clicking checkbox without entire row selection

Open headwinds opened this issue 7 years ago • 4 comments

Is it possible enable the checkbox but disable the entire row being select with the SELECTION plugin?

I'm basically looking for a row or checkbox flag? Or it might be nice to have a target like "row" or "cell" or "checkbox" - so that we could click on the cell containing the checkbox.

what does 'activeCls' do?

SELECTION_MODEL: {
                mode: 'checkbox-multi',
                enabled: true,
                allowDeselect: true,
                activeCls: 'active',
                selectionEvent: 'singleclick'
            },

headwinds avatar Feb 18 '17 14:02 headwinds

At this time, the selection-model is designed around row selection. We could support cell selection, but that would be a pretty drastic change.

activeCls is the className that gets added to a row once it gets selected. This is a dynamic property.

bencripps avatar Feb 18 '17 15:02 bencripps

I'll try to disable pointer-events on my custom cell

headwinds avatar Feb 18 '17 16:02 headwinds

I stumbled across what I wanted but you may not have intended this to happen...

If you set activeCls to false, the rows will change color as you hover over and click on them but the checkbox will not toggle state when the selectionEvent is set to 'singleclick'.

But, with the selectionEvent set to doubleclick, you can click and toggle the state of the checkbox as you normally would; it doesn't require double clicking. If you click anywhere else on the row, the checkbox won't toggle state; you need to click the checkbox directly.

SELECTION_MODEL: {
                mode: 'checkbox-multi',
                enabled: true,
                allowDeselect: true,
                activeCls: 'false',
                selectionEvent: 'doubleclick'
            },

In my case, I didn't want the rows to become selected if the user clicks to edit a cell... only if they click the checkbox.

gif demo gif by kap

headwinds avatar Feb 22 '17 03:02 headwinds

In this case, you should have selectionEvent: false. This isn't documented well -- but selection event really only deals with clicking on a row. If you click the checkbox, it will always make the row selected. Since you say there is no selection event, the row will never be selected unless the checkbox is checked. Let me know if that's what you're looking for, and we can update the docs if it works.

bencripps avatar Feb 22 '17 14:02 bencripps