Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
Maintaining A selection Overlay when active row is selected.
posted

Ok let me see if I can explain what I want to do...

I have grid with a Selection Overlay.  The user selects several rows and at this point the Active Row/Cell is on the last row in "selected".   Now when the user click on a row the selection overlay is reset to the last row.

What I want, is that if the user clicks on a cell anywhere in the "selected" rows, the selection is maintained when the cell goes into edit mode. 

The idea, is I want the user to be able to enter values in one cell and have the values in the same cell on other selected rows change to what the user has entered in the active cell.  My problem is, as soon as I "active" a cell the selection overlay clears.

Ideally, if the user clicked on a row that was NOT in the selection then it would clear the selection.  if they click a row that IS in the selection it would maintain the selection. 

Here is an example:

The grid has several rows selected.

 Now I want to go and enter a value in the "One Plug" column and then have all the rows have the same value.

But as soon as I click on a the "One Plug" cell, it puts clear s the selection.

I'm not worried about updating the values in the other cells.  I know that I will have to use the SelectedRows collection in the CellChange event handler.  I know how to do this. 

But I need the selection to be "sticky".   So is there an easy way to do this?  The setting has not popped out at me.   I'm playing with Before and After Row active to see if I can make it work.  But I thought I would ask before I spent to much time hacking around...

Dan

Parents
  • 469350
    Offline posted

    Hi Dan,

    This is not possible. Any time a cell goes into edit mode, the grid will clear any selected rows. There is no way to prevent this.

    The only way you could achieve this would be to turn off the grid's built-in row selection functionality and then handle all of the mouse and keyboard interaction with the grid yourself - essentially re-implementing row selection yourself.

    This would, of course, be terribly difficult and complex.

     

    EDIT: Another idea just occurred to me. What if, instead of using Selection, you used a CheckBox? You could add an unbound column to the grid and set it's DataType to Boolean. Then you could keep a collection of the "checked" rows. You could use the InitializeRow event to highlight the checked rows (although it would be difficult to provide a selection overlay, so you would probably have to just use a solid color to highlight the rows).

    This would allow you to control which rows are checked. You could clear (uncheck) the checked rows when a cell in an unchecked row goes into edit mode, and do nothing when a cell goes into edit mode on a checked row.

Reply Children