Reordering Cells and Rows
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview for reordering cells and 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 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

This topic contains the following sections:


Introduction

Reordering summary

The IGGridView supports both cell and row reordering. Movable cells and columns give the user the flexibility to move and rearrange presented data.

Cell reordering is turned on through the IGGridViewSingleFieldMultiColumnDataSourceHelper or IGGridViewSingleRowSingleFieldDataSourceHelper by setting the allowCellReordering property. To enable cell reordering when using the IGGridViewDataSource protocol, implement the following method.

  • -(BOOL)gridView:(IGGridView*)gridView canMoveCellAtPath:(IGCellPath *)path

When turned on, cell reordering allows you to touch select a cell and drag it to the desired position.

Use the IGGridView’s rowReordering property to enable row-reordering. Although the IGGridViewDataSourceHelper’s allowRowReordering property exists, use the IGGridView’s rowReordering property because of its reordering column UI capabilities. Additionally, there is a setRowReordering method used for enabling row reordering that includes animation parameters. Enabling row reordering displays results in a row reordering column on the right side of the row. Use the IGGridView’s rowReorderingColumnWidth property to configure the reordering column’s width. Finally, it is important to note that the entire reordering cell can be customized by implementing the IGGridViewDataSource’s following method and placing a custom view inside of it.

  • -(IGGridViewReorderCell*) gridView:(IGGridView*)gridView cellForReorderingAtPath:(IGCellPath*)path;
Note: Using the IGGridViewDataSource’s canMoveRowAtPath method and return NO for a particular row results in that row not having a row reordering indicator.

Cells and rows can be moved from code behind by using the following IGGridView’s methods.

  • -(void)moveRowAtPath:(IGRowPath*)path toPath:(IGRowPath*)newPath;
  • -(void)moveCellAtPath:(IGCellPath*)path toPath:(IGCellPath*)newPath;
Note: Before using either of these two methods above, update your data source with the changes, then call either moveRowAtPath or moveCellAtPath to animate the cell or row’s movement to their new position.

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.