Version

Handling Events (igLayoutManager)

Topic Overview

Purpose

This topic explains, with a code examples, how to attach event handlers to the igLayoutManager™ control.

Required background

The following topics are prerequisites to understanding this topic:

  • Using Events in Ignite UI for jQuery: This topic explains how to manage the required resources to work with Ignite UI for jQuery® within a Web application.

  • igLayoutManager Overview: This topic explains the igLayoutManager control conceptually and provides information on the supported layouts and their uses.

  • Adding igLayoutManager: This topic demonstrates, with code examples, how to add the igLayoutManager control to an HTML page using either pure HTML, JavaScript, or ASP.MVC implementations.

In this topic

This topic contains the following sections:

Handling Events – Conceptual Overview

Handling events summary

Attaching event handler functions to the igLayoutManager control is commonly done upon the initialization of the control.

When using the Ignite UI for MVC, it is necessary to assign event handlers at run-time because you cannot define event handlers within the HTML helper.

jQuery supports the following methods for assigning event handlers:

  • bind()
  • delegate()
  • live()
  • on()

The igLayoutManager supports the following events:

  • itemRendering –fired after an item has been rendered in the container the items
  • itemRendered –fired after all items are rendered
  • rendered –fired before an item is going to accommodate 100% of the container's width or height

For details on how to handle events, refer to the Using Events in Ignite UI for jQuery topic.

Event handling cases summary chart

The following table explains briefly the event handling cases related the igLayoutManager. Further details are available after the table.

Event handling case Details
Handling events upon initialization in jQuery When binding to events on widget initialization, you subscribe to the event using an option which in the following format: <eventName>: <handler> The valid settings for <eventName> are:
  • itemRendering
  • itemRendered
  • rendred
Handling events at run-time in jQuery and ASP.NET MVC You can assign the event handler to the name of a function in order to implement the handler outside control initialization.

Code Examples

The following table lists the code examples included in this topic.

Example Description
Handling the itemRendered Event Upon Initialization in jQuery This example assigns an event handling function to the itemRendered event upon initialization in jQuery.
Handling the itemRendered Event Upon Initialization in ASP.NET MVC This example assigns an event handling function to the itemRendered event upon initialization using the Ignite UI for MVC.
Handling the itemRendered Event at Run-Time in jQuery This example assigns an event handling function to the itemRendered event at run-time in jQuery.
Handling the itemRendered Event at Run-Time in ASP.NET MVC This example assigns an event handling function to the itemRendered event at run-time using the Ignite UI for MVC.

Code Example: Handling the itemRendered Event Upon Initialization in jQuery

Description

This example assigns an event handling function to the itemRendered event upon initialization in jQuery.

Code

In JavaScript:

$(".selector").igLayoutManager({
                        itemRendered: function(evt, ui) { 
                              // Handle event
                        }
});

Code Example: Handling the itemRendered Event Upon Initialization in ASP.NET MVC

Description

This example assigns an event handling function to the itemRendered event upon initialization using the Ignite UI for MVC.

Code

In ASPX (MVC):

@(Html.Infragistics().LayoutManager()
        .AddClientEvent("iglayoutmanageritemrendered", "itemRenderedHandler")
        .Render());

Code Example: Handling the itemRendered Event at Run-Time in jQuery

Description

This example assigns an event handling function to the itemRendered event at run-time in jQuery.

Code

In JavaScript:

$(document).delegate(".selector", "iglayoutmanageritemrendered", function(evt, ui) { 
   // Handle event
});

Code Example: Handling the itemRendered Event at Run-Time in ASP.NET MVC

Description

This example assigns an event handling function to the itemRendered event at run-time using the Ignite UI for MVC.

Code

In JavaScript:

$(document).delegate(".selector", "iglayoutmanageritemrendered", function(evt, ui) { 
   // Handle event
});

Related Content

Topics

The following topics provide additional information related to this topic.

  • Configuring the Layouts (igLayoutManager) This topic explains, with code examples, how to configure the title and subtitle of the igLayoutManager control. This includes the title area width the start position of the text and the title/subtitle text itself.

Samples

The following samples provide additional information related to this topic.

  • ASP.NET MVC Basic Usage: This sample demonstrates using the Ignite UI for MVC Layout Manager control.

  • Border Layout from HTML Markup: This sample demonstrates initializing the igLayoutManager control’s Border layout from the HTML markup by assigning "center"/"left"/"right"/"header"/"footer" CSS classes.

  • Border Layout – Initializing with JavaScript: This sample demonstrates initializing the igLayoutManager control’s Border layout from JavaScript, by handling itemRendered events and assigning content to the created regions.

  • Responsive Column Layout: This sample demonstrates how the igLayoutManager control’s Column layout can be used by assigning classes to items thus specifying the area their content will span over. This sample does not use JavaScript initialization code: it is done with CSS and HTML only.

  • Responsive Flow Layout: This sample demonstrates the responsiveness of the igLayoutManager control’s Flow layout with various item sizes set either in pixels or percentages and setting the number of items in the igLayoutManager's options without the need for any initial markup.

  • Grid Layout with colspan and rowspan Support: This sample demonstrates the ability of the igLayoutManager control’s Grid layout to allow items to have arbitrary position in a grid with a predefined size including for items with different rowspan and colspan settings.

  • Grid Layout with Custom Size: This sample demonstrates the igLayoutManager control’s Grid layout having specific width and height for each column.

  • Responsive Vertical Layout" This sample s demonstrates the responsiveness of the igLayoutManager control’s Vertical layout with various item sizes set either in pixels or percentages and setting the number of items in the igLayoutManager's options without the need for any initial markup.

View on GitHub