1 Reply Latest reply on Aug 11, 2010 2:36 AM by Didier Bolf

    select several cells on the same row of an OLAPDataGrid

    Didier Bolf

      hello

       

      I have:

       

      var odg:OLAPDataGrid = new OLAPDataGrid()

      odg.selectionMode = "multipleCells";

      ...

       

      when I try to select programmatically  several cells on the same row, for example :

           odg.selectedCells = [{rowIndex: 1, columnIndex: 2}, {rowIndex: 1, columnIndex: 4}];

           odg.validateNow();

      it works, the both cells are selected. but then I cannot unselect the second cell anymore (by clicking a cell in the grid)

       

       

      the problem occurs when I try to select two cells of the same row at the same time using selectedCells setter.

      when the cells are not on the same row, it works

       

       

      thanks for your help

      best regards

       

      Didier

        • 1. Re: select several cells on the same row of an OLAPDataGrid
          Didier Bolf Level 1

          in fact I wanted to select cells by row or column (I believe this is not supported with the olapdatagrid)

          I found something that seems working ...

           

          package
          {
              import mx.controls.OLAPDataGrid;
              import mx.controls.listClasses.IListItemRenderer;
             
              public class OLAPDataGridEx extends OLAPDataGrid {

                  public function selectRow(rowIndex:int, firstColumnIndex:int, lastColumnIndex:int):void {
                      var visibleCoords:Object = absoluteToVisibleIndices(rowIndex,firstColumnIndex);
                      var listItem:IListItemRenderer = listItems[visibleCoords.rowIndex][visibleCoords.columnIndex];
                      selectCellItem(listItem, false, false);
                      visibleCoords = absoluteToVisibleIndices(rowIndex, lastColumnIndex);
                      var listItem:IListItemRenderer = listItems[visibleCoords.rowIndex][visibleCoords.columnIndex];
                      selectCellItem(listItem, true, false);
                      validateNow();
                  }
                 
                  public function selectColumn(columnIndex:int, firstRowIndex:int, lastRowIndex:int):void {
                      var visibleCoords:Object = absoluteToVisibleIndices(firstRowIndex, columnIndex);
                      var listItem:IListItemRenderer = listItems[visibleCoords.rowIndex][visibleCoords.columnIndex];
                      selectCellItem(listItem, false, false);
                      visibleCoords = absoluteToVisibleIndices(lastRowIndex, columnIndex);
                      var listItem:IListItemRenderer = listItems[visibleCoords.rowIndex][visibleCoords.columnIndex];
                      selectCellItem(listItem, true, false);
                      validateNow();
                  }
                 
              }
          }

           

           

          bye

          didier