Working with Dashboard Table Block

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example determines a distance between dashboard table block rows and columns, and also the number of rows, columns and cell in the block.

Source Code

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

// Get dashboard
APKap *kap = [m_controller valueForKey:@"m_report"];
// Get the area containing dashboard objects
APArea *area = [[[kap view] valueForKey:@"m_contentView"] valueForKey:@"m_layout"];
// Get array of embedded objects
NSMutableArray *objects = [area objects];
for (id object in objects) {
    if ([object isKindOfClass:[APGrid class]]) {
        // Get dashboard table block
        APGrid *grid = (APGrid*)object;
        NSLog(@"Distance between table rows: %f", [grid verticalSpacing]);
        NSLog(@"Distance between table columns: %f", [grid horizontalSpacing]);
        NSLog(@"Number of table rows: %d", [[grid rows] count]);
        NSLog(@"Number of table columns: %d", [[grid columns] count]);
        NSLog(@"Number of table cells: %d", [[grid cells] count]);
    }
}

After executing the example the browser console displays values of all dashboard table block properties:

Distance between table rows: 0.00000

Distance between tale columns: 0.00000

Number of table rows: 2

Number of table columns: 2
Number of table cells: 3

See also:

Example of Component Use