3.0 beta 2

Toggle between Row Selection and Cell Selection

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

GOAL:
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.

EXPLANATION:
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(event, column, row) {

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

      this.setSelectedColumns([]);  // deselect any selected columns...
      this.setSelectedRows([]);  // deselect any selected rows...
      this.setSelectionMode("single-cell");
    }
  };

  obj.onSelectorMouseDown = function(event, index) {

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

      this.setSelectedColumns([]);  // deselect any selected columns...
      this.setSelectedRows([]);  // deselect any selected rows...
      this.setSelectionMode("single-row");
    }
  };

ArdMan
April 20,
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
May 15,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.