Removing Table Header Elements

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays working with table header elements. After starting the example the following operations are executed:

Source Code

Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Data Analysis section):

// Get table left header
SPPLPivotHeader topPivotHeader = m_gridPivot->topHeader();
// Get data source dimension selection
SPPLDimensionSelectionSet selectionSet = m_gridPivot->selectionSet();
SPPLPivotTableHeaderElements pivotTableHeaderElements = new PPLPivotTableHeaderElements(topPivotHeader->dimensions(), selectionSet);
printf("Initial number of elements: %d \n", pivotTableHeaderElements->elementsCount());
//SNMutableArray indexes = new NMutableArray();
for (int i = pivotTableHeaderElements->elementsCount() - 1; i >= 0; i--) {
    SPPLPivotTableHeaderElement element = pivotTableHeaderElements->getElementByIndex(i);
    switch (i) {
        case 1:
        // Remove element by index
        pivotTableHeaderElements->removeElementByIndex(i);
        break;
        case 2:
        // Remove element
        pivotTableHeaderElements->removeElement(element);
        break;
        case 3:
        // Remove element by array of indexes
        SNArray indexes = NArray::arrayWithObject(NNumber::numberWithInt(i));
        pivotTableHeaderElements->removeElementsWithIndexes(indexes);
        break;
    }
}
printf("Remained number of elements: %d \n", pivotTableHeaderElements->elementsCount());

After executing the example the development environment console displays the number of table elements before and after their removal:

Initial number of elements: 6

Remained number of elements: 3

See also:

Example of pplib++ Library Use