This topic demonstrates, with code examples, how to add the igLayoutManager
™ control to an HTML page using either pure HTML or JavaScript implementation.
The following topics are prerequisites to understanding this topic:
igLayoutManager
control conceptually and provides information on the supported layouts and their uses.This topic contains the following sections:
The igLayoutManager
initializes on an unordered list (<ul>
) element with list items (<li>
) elements or <div>
elements. The list can be created in any of the following ways:
<li>
or <div>
elements can be defined in the HTML markup of the host element, and upon initialization, the control will add the respective CSS classesWith this approach, an items collection and the itemCount property are used and the igLayoutManager
generates the corresponding markup.
Note:When defining the number of items using the
itemCount
property, you should not define any items in the markup. Defining items in the markup together with setting theitemCount
is an undefined scenario and will result in adding the items defined withitemCount
property to those defined in the markup.
The following table summarizes the requirements for igLayoutManager
control.
Requirement / Required Resource | Description | What you need to do… | ||||
---|---|---|---|---|---|---|
jQuery and jQuery UI JavaScript resources | Ignite UI for jQuery is built on top of these frameworks: | Add script references to both libraries in the <head> section of your page. | ||||
igLayoutManager JavaScript resources |
The igLayoutManager functionality of the Ignite UI for jQuery library is distributed across several files. You can load the required resources in one of the following ways:
|
Add one of the following:
|
||||
IG theme (Optional) | This theme contains the visual styles for the Ignite UI for jQuery library. The theme file is: {IG CSS root}/themes/Infragistics/infragistics.theme.css | |||||
igLayoutManager structure | The styles from the following CSS file are used for rendering various elements of the control: {IG CSS root}/structure/modules/infragistics.ui.layout.css | Add style reference to the file in your page. |
Note:It is recommended to use the
igLoader
component to load JavaScript and CSS resources. For information on how to do this, refer to the Adding Required Resources Automatically with the Infragistics Loader topic. In addition to that, in the online Ignite UI for jQuery Samples Browser, you can find some specific examples on how to use theigLoader
with theigLayoutManager
component.
Following are the general conceptual steps for adding igLayoutManager
to an HTML page.
Adding the HTML element to host the igLayoutManager
control
Instantiating igLayoutManager
and specify the layout
This procedure guides you through the steps of adding an igLayoutManager
control with Flow layout and default settings to an HTML page. This is a pure HTML/JavaScript implementation. It uses the Infragistics Loader (igLoader
) component to load all Ignite UI for jQuery resources needed by the igLayoutManager
control. The markup is also defined in an HTML page. The igLayoutManager
initializes directly in the HTML markup (i.e on an <ul>
element with <li>
elements).
For other scenarios, refer to Configuring igLayoutManager.
The following screenshot is a preview of the result.
The required resources added and properly referenced. (For a conceptual overview of those resources, see Requirements.) These include:
The required JavaScript resources referenced in the <head>
section of the page.
In HTML:
<script type="text/javascript" src="Scripts/jquery.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui.js"></script>
The igLoader
component referenced on the page.
In HTML:
<script type="text/javascript" src="Scripts/ig/infragistics.loader.js"></script>
The igLoader
component instantiated:
In HTML:
<script type="text/javascript">
$.ig.loader({
scriptPath: "Scripts/ig/",
cssPath: "Content/ig/",
resources: "igLayoutManager"
});
</script>
The following steps demonstrate how to add a basic igLayoutManager
control to a web page with Flow layout.
Add the HTML element to host the igLayoutManager
control.
Add an HTML <ul>
element to host the igLayoutManager
control on the HTML page.
In HTML:
<ul id="layout">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
Instantiate igLayoutManager
and specify the layout.
Add the initialization code to a script element in the HTML page. The initialization code creates igLayoutManager
instance in the <ul>
element added in step 1.
The following code creates an instance of the igLayoutManager
control.
In JavaScript:
$.ig.loader(function () {
// Create a basic igLayoutManager control
$("#layout").igLayoutManager({
layoutMode: "flow"
});
});
This procedure guides you through the steps of adding an igLayoutManager
control with basic functionality to an HTML page using a pure HTML/JavaScript implementation. It uses the Infragistics Loader component to load all Ignite UI for jQuery resources needed by the igLayoutManager
control. The igLayoutManager
initializes as an array of item objects in the control options (i.e. on a blank <ul>
element, and the number of items is provided inside the instance of igLayoutManager
using the itemCount
property).
The following screenshot is a preview of the final result.
The required resources added and properly referenced. (For a conceptual overview of those resources, see Requirements.) These include:
The required JavaScript resources referenced in the <head>
section of the page.
In HTML:
<script type="text/javascript" src="Scripts/jquery.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui.js"></script>
The igLoader
component referenced on the page.
In HTML:
<script type="text/javascript" src="Scripts/ig/infragistics.loader.js"></script>
The igLoader
component instantiated:
In HTML:
<script type="text/javascript">
$.ig.loader({
scriptPath: "Scripts/ig/",
cssPath: "Content/ig/",
resources: "igLayoutManager"
});
</script>
The following steps demonstrate how to add a basic igLayoutManager
control with Flow layout to an HTML page using JavaScript implementation. For other scenarios, read at Configuring igLayoutManager.
Add an HTML element to host igLayoutManager
.
Add an HTML <ul>
element to host igLayoutManager
on the HTML page.
In HTML:
<ul id="layout">
</ul>
Instantiate igLayoutManager
and specify the layout.
Add the initialization code to a script element in the HTML page. The initialization code creates igLayoutManager
instance in the <ul>
element added in step 1.
The following code creates an instance of the igLayoutManager
control.
In JavaScript:
$.ig.loader(function () {
// Create a basic igLayoutManager control
$("#layout").igLayoutManager({
layoutMode: "flow",
itemCount: 11,
});
});
The following sample demonstrates initializing the Layout Manager control's Border layout from JavaScript, by handling itemRendered
events and assigning content to the created regions.
This procedure guides you through the steps of adding an igLayoutManager
with basic functionality to an ASP.NET MVC view. The example uses the ASP.NET MVC syntax together with the required Loader configuration. The igLayoutManager
initializes as an array of item objects in the control options (i.e. on a blank <ul>
element, and the number of items is provided inside the instance of igLayoutManager
using the itemCount
property).
The following screenshot is a preview of the final result.
The required resources added and properly referenced. (For a conceptual overview of those resources, see Prerequisites.) These include:
The required JavaScript resources referenced in the <head>
section of the page.
In HTML:
<script type="text/javascript" src="Scripts/jquery.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui.js"></script>
The igLoader
component referenced on the page.
In HTML:
<script type="text/javascript" src="Scripts/ig/infragistics.loader.js"></script>
The igLoader
component instantiated in ASP.NET view:
In ASPX:
@(Html.Infragistics()
.Loader()
.ScriptPath("http://localhost/ig_ui/js/")
.CssPath("http://localhost/ig_ui/css/")
.Render()
)
The following steps demonstrate how to add a basic igLayoutManager
control with Flow Layout to an ASP.NET MVC application.
Add the igLayoutManager
control.
Add an HTML <ul>
element to host igLayoutManager
on the HTML page.
In HTML:
<ul id="layout"></ul>
Instantiate igLayoutManager
The following code creates an instance of the igLayoutManager
control.
In ASPX:
@(Html.Infragistics()
.ID("layout")
.LayoutMode("flow")
.ItemCount(11)
.Render()
)
The following topics provide additional information related to this topic.
Configuring igLayoutManager: This topic explains, with code examples, how to configure the different layouts supported by the the igLayoutManager
control.
Handling Events(igLayoutManager): This topic explains, with code examples, how to attach event handlers to the igLayoutManager
control.
igLayoutManager Accessibility Compliance: This topic explains the accessibility features of the igLayoutManager
control and provides information on how to achieve accessibility compliance for pages containing this control.
Known Issues and Limitations (igLayoutManager): This topic provides information about the known issues and limitations of the igLayoutManager
control.
jQuery and MVC API Links (igLayoutManager): This topic provides links to the API documentation for jQuery and its ASP.NET MVC helper class for the igLayoutManager
control.
The following samples provide additional information related to this topic.
ASP.NET MVC Basic Usage: This sample demonstrates using the ASP.NET MVC helper for the 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.
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