Igniteui-angular: Cell selection set to 'none' triggers row selection

Created on 23 Oct 2019  路  4Comments  路  Source: IgniteUI/igniteui-angular

Description

An igx-grid with cellSelection set to 'none' is supposed to have no impact on row selection feature.

  • igniteui-angular version: 8.2 and above
  • browser: any

Steps to reproduce

  1. Open the sample
  2. Click on any grid cell. The corresponding row is now selected

Expected result

Cell selection when set to 'none' behave as in 8.1.9 (when no cellSelection was defined for IgxGridComponent) like in this example.
I'm expecting this behavior because users are used to click on cells when scrolling or navigating to different pages wishing not to change the current set of selected rows.

Thank you, regards

general row-selection selection not-a-bug 8.2.0

Most helpful comment

Currently, row selection is performed on row click, the workaround that i suggest you is to just stop the propagation of the click event from the cell to the row, where row selection is performed. If you perform mouse drag between multiple cells, click event is not triggered over cell but directly over the row element.
So you should have probably seen that when row selection is performed, the onRowSelectionChange event is emitted, so you can cancel the selection based on any custom logic that fulfill your use case. Here is an example.

All 4 comments

Hello @rrr3da ,
Since version 8.2.x there are some major changes in the grid selection, tree new properties are introduced (cellSelection, rowSelection and hideRowSelectors) and the old properties related to the selection are deprecated. You can read our changelog.md and our official documentation where this is explained in more details. The behavior that you need can be still achieved if you stop the propagation of the cell click event. Take a look at the following sample.

Dear @ddincheva,

The sample you provided me shows a workaround I already tried, but there's an additional issue I'm addressing below. We can move it to a new thread if needed.

Steps to reproduce

Starting from the sample:

  1. Click on a cell and keep the left mouse button down
  2. Move the pointer on an adjacent cell on the same row and release the left mouse button

Result

The row is now selected, the previous row selection is lost.

Regards,
Stefano

Currently, row selection is performed on row click, the workaround that i suggest you is to just stop the propagation of the click event from the cell to the row, where row selection is performed. If you perform mouse drag between multiple cells, click event is not triggered over cell but directly over the row element.
So you should have probably seen that when row selection is performed, the onRowSelectionChange event is emitted, so you can cancel the selection based on any custom logic that fulfill your use case. Here is an example.

Thank you, that was the perfect workaround.
Regards

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hypenate picture Hypenate  路  3Comments

ChronosSF picture ChronosSF  路  3Comments

nikunjgajera picture nikunjgajera  路  3Comments

cornel-stoica-str picture cornel-stoica-str  路  3Comments

nikunjgajera picture nikunjgajera  路  3Comments