MicroStrategy ONE

Use a Custom Widget as a Selector in iOS

When an out-of-the-box MicroStrategy widget is added to a document, it can be used as a selector that targets other controls in the document. You can also enable a custom widget that you build to act as a selector.

The following dataset is used by the code samples in this topic to show how to use a custom widget as a selector:

 

      

There are two different types of axis cells in the grid:  

  • ROW_AXIS cells
    The row axis cells correspond to the attributes that are placed in the rows of the grid. The row index and column index for the cells in the columns of the grid are color-coded in the two left columns of the table below.  

  • COLUMN_AXIS cells
    The column axis cells correspond to the attributes that are placed in the columns of the grid.  The row index and column index for the cells in the rows of the grid are color-coded in the top two rows of the table below.

To make selections, use MSIWidgetHelper, as described below:

  •  If you want to select the element "111"  

    Copy
    [self.widgetHelper handleCellSelectionByAxisType:ROW_AXIS andRowIndex:0 andColIndex:0];
                
  •  If you want to select the element  "bbb"  

    Copy
     [self.widgetHelper handleCellSelectionByAxisType:ROW_AXIS andRowIndex:1 andColIndex:1];
  • If you want to select the first row ("111" and "aaa")

    Copy
    [self.widgetHelper handleCellSelectionsForEntireRowByAxisType:ROW_AXIS andRowIndex:0 ]
                
  • If you want to select the second row ("111" and "bbb")  

    Copy
    [self.widgetHelper handleCellSelectionsForEntireRowByAxisType:ROW_AXIS andRowIndex:1 ]
                
  •  If you want to select several element that are not in the same row ("111" and "ccc")  

    Copy
    NSMutableArray *selections = [NSMutableArray arrayWithCapacity:3];
       // add element "111"
            {
                SelectionCoordinate *coord = [[SelectionCoordinate alloc] init];
                coord.selectionType = 1;
                coord.axisType = ROW_AXIS;
                coord.depth = 0;
                coord.ordinal = 0;
                [selections addObject:coord];
                [coord release];
            }
       //add element "ccc"
            {
                SelectionCoordinate *coord = [[SelectionCoordinate alloc] init];
                coord.selectionType = 1;
                coord.axisType = ROW_AXIS;
                coord.depth = 1;
                coord.ordinal = 2;
                [selections addObject:coord];
                [coord release];
            }
    [self.widgetHelper handleSelectionsForCoordinateArray:selections];