:: Forum >> Version 2 >>

Toggle between Row Selection and Cell Selection

More information on this topic is available in the documentation section: /aw.ui.grid/selection-mode.html.

How do you toggle between row selection and cell selection modes?

I'd like to switch to:
A. "single-cell" mode when a cell is clicked.
B. "single-row" mode when a row's selector is clicked.

There are a few things to keep in mind.

1. Grid Selector Events
Grid selection is triggered by Mouse events. Use the setSelectionMode method to switch between "single-cell" and "single-row" modes.

2. Deselect Rows
Before switching between "single-cell" and "single-row" selection modes, the selected rows and columns need to be deselected (or unselected... pick your favorite term). Use the setSelectedRows and setSelectedColumns to deselect any rows that are selected.

obj.onCellMouseDown = function(eventcolumnrow) {

    if (
this.getSelectionMode() != "single-cell") {

this.setSelectedColumns([]);  // deselect any selected columns...
this.setSelectedRows([]);  // deselect any selected rows...

obj.onSelectorMouseDown = function(eventindex) {

    if (
this.getSelectionMode() != "single-row") {

this.setSelectedColumns([]);  // deselect any selected columns...
this.setSelectedRows([]);  // deselect any selected rows...
Thursday, April 20, 2006
This is excellent code.

I am trying to modify it to toggle between
"single-cell" mode when a cell is clicked.
"multi-row" mode when a row's selector is clicked.

I have not had much luck I keep loosing references to the previously selected rows.

Any Ideas or solutions
Colin P
Monday, May 15, 2006

This topic is archived.

Back to /aw.ui.grid/selection-mode.html


Forum search