Fixed Columns
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview, with code, on fixing columns to the left or right side of 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 how to add the grid framework file to the project.


In this topic


Introduction

Fixed columns summary

Fixed columns allow a column to stay in view on either the left or right side of the IGGridView, while allowing horizontal scrolling of the other columns. To specify how many columns to fix on the left or right of the IGGridView, and create those cells, the following methods are available through the IGGridViewDataSource protocol.

  • -(int)numberOfFixedLeftColumnsInGridView:(IGGridView *)gridView
  • -(int)numberOfFixedRightColumnsInGridView:(IGGridView *)gridView
  • -(NSString *)gridView:(IGGridView *)gridView titleForHeaderInFixedLeftColumn:(int)column
  • -(NSString *)gridView:(IGGridView *)gridView titleForHeaderInFixedRightColumn:(int)column
  • -(IGGridViewCell *)gridView:(IGGridView *)gridView fixedLeftCellAt:(IGCellPath *)path
  • -(IGGridViewCell *)gridView:(IGGridView *)gridView fixedRightCellAt:(IGCellPath *)path

Additional methods are also available in the IGGridViewDelegate to customize fixed columns further.

  • -(IGColumnWidth *)gridView:(IGGridView *)gridView widthForFixedLeftColumnAtIndex:(int)column
  • -(IGColumnWidth *)gridView:(IGGridView *)gridView widthForFixedRightColumnAtIndex:(int)column
  • -(void)gridView:(IGGridView *)gridView willDisplayFixedLeftCell:(IGGridViewCell *)cell forPath:(IGCellPath *)path
  • -(void)gridView:(IGGridView *)gridView willDisplayFixedRightCell:(IGGridViewCell *)cell forPath:(IGCellPath *)path

When you define a fixed column a separator is shown to separate the fixed columns from the normal columns and creates a clear delineation. The grid view offers these properties to style the separator.

  • fixedLeftColumnSeparatorWidth
  • fixedRightColumnSeparatorWidth
  • fixedLeftColumnSeparatorColor
  • fixedRightColumnSeparatorColor

Inserting and Deleting a Fixed Column – Code Example

Description

The following code example demonstrates how to insert and delete a fixed column on the left side of the IGGridView.

Code

In Objective-C:

//Insert left fixed column
IGGridViewColumnDefinition* colLeft = [[IGGridViewColumnDefinition alloc]initWithKey:@"prop1"];
colLeft.headerText = @"Fixed";
[_dsh.fixedLeftColumns insertObject:colLeft atIndex:0];
[_gridView insertFixedLeftColumnsAtIndexes:[NSArray arrayWithObject:[NSNumber numberWithInt:0]]];
//Delete left fixed column
[_dsh.fixedLeftColumns removeObjectAtIndex:0];
[_gridView deleteFixedLeftColumnsAtIndexes:[NSArray arrayWithObject:@0]];

In C#:

//Insert left fixed column IGGridViewColumnDefinition colLeft = new IGGridViewColumnDefinition("prop1");
colLeft.HeaderText = "Fixed";
dsh.FixedLeftColumns.Insert(colLeft, 0);
grid.InsertFixedLeftColumns(new NSObject[]{new NSNumber(0)});

 

//Delete left fixed column dsh.FixedLeftColumns.RemoveObject(0);
grid.DeleteFixedLeftColumns(new NSObject[]{new NSNumber(0)});


Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

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