Filtering
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview, with code, on filtering rows on the IGGridView™ control.

Required background

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

Topic

Purpose

Adding the Grid 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


Introduction

Filtering summary

To enable filtering, set the data source helpers’ filteringKey property to a string that maps to a property of the underlying data object. Using the filterType property found on the data source helper it is possible to set a filter condition using these enumerations.

  • IGGridViewFilterConditionTypeStringContains
  • IGGridViewFilterConditionTypeStringBeginsWith
  • IGGridViewFilterConditionTypeStringEndsWith
  • IGGridViewFilterConditionTypeStringLike
  • IGGridViewFilterConditionTypeStringMatches
  • IGGridViewFilterConditionTypeNumberEquals
  • IGGridViewFilterConditionTypeNumberNotEquals
  • IGGridViewFilterConditionTypeNumberGreaterThan
  • IGGridViewFilterConditionTypeNumberGreaterThanEquals
  • IGGridViewFilterConditionTypeNumberLessThan
  • IGGridViewFilterConditionTypeNumberLessThanEquals

On the IGGridView, the property named filterAction can be used to determine when the filter should be applied. The default value for this property is IGGridViewFilterActionImmediate, but the following enumerations can be used.

  • IGGridViewFilterActionImmediate - after each key press.
  • IGGridViewFilterActionDoneEditing - when the user finishes typing.

Enable Filtering on a Column – Code Example

Description

The following code sets the filteringKey property on the data source helper to filter on the firstName column using a, starts with, condition set on the filterType property and to apply the filter immediately after a key press with the filterAction property.

Code

In Objective-C:

    // Use this DataSource Helper to create a single row data source, using the column we defined above. 
    IGGridViewDataSourceHelper* ds = [[IGGridViewDataSourceHelper alloc] init];
    
    // To enable filtering, simply set the Filtering key on the DataSourceHelper
    ds.filteringKey = @"firstName";
    
    // To modify the type of filtering, set the FilterType property
    ds.filterType  = IGGridViewFilterConditionTypeStringBeginsWith;
    
    // To edit whether filtering happens immediately, or after the user is done typing, change the filter action property on the IGGridView.
    _gridView.filterAction = IGGridViewFilterActionImmediate;
    
    ds.data  = data;
    _gridView.dataSource = ds;

In C#:

    // Use this DataSource Helper to create a single row data source, using the column we defined above. 
    IGGridViewDataSourceHelper ds = new IGGridViewDataSourceHelper();
    
    // To enable filtering, simply set the Filtering key on the DataSourceHelper
    ds.FilteringKey = @"firstName";
    
    // To modify the type of filtering, set the FilterType property
    ds.FilterType  = IGGridViewFilterConditionType.IGGridViewFilterConditionTypeStringBeginsWith;
    
    // To edit whether filtering happens immediately, or after the user is done typing, change the filter action property on the IGGridView.
    _gridView.FilterAction = IGGridViewFilterAction.IGGridViewFilterActionImmediate;
    
    ds.Data  = data;
    _gridView.WeakDataSource= ds;

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 with getting up and running with using the control.

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