Data Helpers
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of how data helpers connect your data to the IGGridView™ control.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic

Purpose

Adding the IG Framework File

This topic explains the requirements for adding the grid framework file to an Xcode project; a requirement for using the IGGridView™ control.


In this topic


Data Helpers

Introduction

Data helpers are useful when trying to display an array of objects without having to implement the IGGridViewDataSource protocol. When it actually becomes time to wire your data source to the IGGridView use any one of three different data source helpers listed in the following table. If these helpers are inadequate for handling how your data maps into grid cells, you can override any of the IGGridViewDataSource protocol methods, including the normalizePath method, to map a cell’s path back to your data.

The IGGridView has three out of the box data helpers for connecting data.

Data Helper

Description

IGGridViewDataSourceHelper

Treats each item in the array as a row, and every public property of the item as a column.

IGGridViewSingleFieldMultiColumnDataSourceHelper

Treats each cell in the grid as a column, which are then divided by the value of the numberOfColumns property and split into rows.

If a row does not have enough columns left over, a cell will not be created for that location.

IGGridViewSingleRowSingleFieldDataSourceHelper

Treats each row as a column and displays only one user assigned field in the underlying data, by using the field property and requires an IGGridViewColumnDefinition type.



Adding Data to the IGGridView with IGGridViewDataSourceHelper – Code Example

Description

Using the IGGridViewDataSourceHelper to connect an array of objects to the IGGridView only requires assigning the data property instead of implementing all of the required members of the IGGridViewDataSource protocol.

Code

The code below populates an NSArray with data and assigns it to the IGGridViewDataSourceHelper’s data property. The data source is then added to the IGGridView through the dataSource property.

In Objective-C:

NSArray* mydata = [self getData];
IGGridViewDataSourceHelper* dataSource= [[IGGridViewDataSourceHelper alloc]init];
dataSource.data = myData;
gridView.dataSource = dataSource;

In C#:

NSObject[] data = this.GetData();
IGGridViewDataSourceHelper dataSource = new IGGridViewDataSourceHelper();
dataSource.Data = data;
gridView.WeakDataSource = dataSource;

Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

This topic provides basic information about creating an instance of the IGGridView™ and displaying data to help you get up and running with this control.

This section serves as an introduction to the IGGridView’s key features and functionalities.