Getting Column Information

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays information about table column in the development environment console. 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 Creating a Simple Data Grid section):

// Get column with the number 1
NuGridColumn *col = [[contr gridView] columnWithNumber:1];
// Get table, to which column belongs
NuGridView *parentGrid =[col parentGrid];
// Set table background color
[parentGrid setBackgroundColor:[UIColor greenColor]];
// Display column width
NSLog(@"%@ %f", @"Column width:", col.width);
// Display whether column is fixed
NSLog(@"%@ %hhd", @"Column is fixed:", col.isFixed);
// Display column index
NSLog(@"%@ %d", @"Column index:", col.columnIndex);
// Display column number
NSLog(@"%@ %d", @"Column number:", col.columnNumber);
// Display whether column contains table headers
NSLog(@"%@ %hhd", @"Column contains table headers:", col.isHeader);
// Get column cell
NuGridCell *cell = [col cellInRowWithIndex:1];
// Display cell value
NSLog(@"%@ %@", @"Cell value:", cell.value);

After executing the example the table background color is changed, the development environment console displays information about the B column:

Column width: 80.000000

Column is fixed: 0

Column index: 1

Column number: 1

Column contains table headers: 0

Cell value: 2

See also:

Examples of Component Use