Hello,
I'm struggling to work with the Selected and Active items provided by the Grid to provide the selection model I would like to give my users. The grid itself has some editable (text and dropdown entry) and non-editable columns and I would like to have a selection model that provides for both single and multiple row selections (via clicking and click-dragging) regardless of the type of cell that they click on (e.g. - clicking on an editable cell should select the row just as clicking on a non-editable cell would).
I do not want cells to become editable when a user clicks on them but rather when they TYPE. So, it forces me to set the CellActivation to CellSelect (rather than RowSelect) so that, when they begin to type, I can tell which cell they are using.
As a result, if they have selected RowA by clicking on a non-editable cell and then they immediately click on an editabe-cell in RowB ... RowB becomes active (and the cell they clicked on becomes the selected cell) but RowA stays the selected row. There are similar problems if they have multi-selected a bunch of rows and then click on an editable cell of a single row. In that case, the multiple selection should disappear and be replaced by the row corresponding to the cell they just clicked on.
I can work around this problem by checking for changes in both the current selected items and the active row (via AfterRowActivate). If there are 3 rows selected and then the active row changes - this implies the user has gone from a multi-select to a single select via some means. But this too breaks down because as the users drags to select multiple rows, the active row continually updates so I can't tell if they mean to select multiple rows or a single row at that point.
Has anyone else implemented something similar to this and have any suggestions?
Thanks in advance!
bmm727 said:I do not want cells to become editable when a user clicks on them but rather when they TYPE. So, it forces me to set the CellActivation to CellSelect (rather than RowSelect) so that, when they begin to type, I can tell which cell they are using.
I'm not sure I understand this part. I think you meant to say CellClickAction rather the CellActivation here. But even so, why can't you set CellClickAction to RowSelect? Clicking on a cell in this case should select the row, and activate the cell. So you can still determine which cell to edit using the ActiveCell, I think.
Hi Mike,
yes you're right, "CellClickAction" but setting it to RowSelect doesn't set the active cell...that's fine actually since I can set it in the handler for the click event. My trouble now, related to my other post (thanks for answering that one too) is keyboard navigation a la Excel. Since KeyMapping doesn't let me un-select the current row, move to the DownCell (or whatever) and then re-select the row...I guess I need to play around with the ActiveRow?
I'm not sure if this helps you but there are KeyActionMappings which toggle between the cell and row selection modes (see UltraGridAction.DeactivateCell and UltraGridAction.ActivateCell). The Ctrl+Space keystrokes are mapped to these actions, so that if there is an ActiveCell, you can deactivate it and activate its row (and vice-versa), and then arrow key navigation would switch over to navigating rows.