Ignite UI API Reference

ig.ArrayDataSource

ig.ArrayDataSource_image

The ArrayDataSource component extends the DataSource class and sets its type to 'array' by default allowing you to bind a control to a standard JavaScript array. Further information regarding the classes, options, events, methods and themes of this API are available under the associated tabs above.

The following code snippet demonstrates how to initialize the ArrayDataSource control.

Click here for more information on how to get started using this API. For details on how to reference the required scripts and themes for the ArrayDataSource control read, Using JavaScript Resources in Ignite UI and Styling and Theming Ignite UI.

Code Sample

<!doctype html>
<html>
<head>
    <!-- Infragistics Combined CSS -->
    <link href="css/themes/infragistics/infragistics.theme.css" rel="stylesheet" type="text/css" />
    <link href="css/structure/infragistics.css" rel="stylesheet" type="text/css" />
    <!-- jQuery Core -->
    <script src="js/jquery.js" type="text/javascript"></script>
    <!-- jQuery UI -->
    <script src="js/jquery-ui.js" type="text/javascript"></script>
    <!-- Infragistics Combined Scripts -->
    <script src="js/infragistics.core.js" type="text/javascript"></script>
     
    <script type="text/javascript">
        var ds, render, arrayOfArraysData, arraySchema;
        render = function (success, error) {
            if (success) {
                    var resultHtml = $.ig.tmpl("<tr><td>${CurrencyCode}</td><td>${Name}</td><td>${ModifiedDate}</td></tr>", ds.dataView());
                    $("#table").html(resultHtml);
            } else {
                alert(error);
            }
        };
         
        arrayOfArraysData = [
            ["AED", "Emirati Dirham", "Jun  1 1998 12:00AM"],
            ["AFA", "Afghani", "Jun  1 1998 12:00AM"],
            ["ALL", "Lek", "Jun  1 1998 12:00AM"],
            ["AMD", "Armenian Dram", "Jun  1 1998 12:00AM"],
        ];
  
        arraySchema = new $.ig.DataSchema("array", {
            fields: [{
                name: "CurrencyCode",
                type: "string"
            }, {
                name: "Name",
                type: "string"
            }, {
                name: "ModifiedDate",
                type: "string"
            }]
        });
  
        $(function () {
            ds = new $.ig.ArrayDataSource({
                dataSource: arrayOfArraysData,
                schema: arraySchema,
                callback: render,
                paging: {
                    enabled: true,
                    pageSize: 10,
                    type: "local"
                }
            });
  
            ds.dataBind();
        });
    </script>
</head>
<body>
    <table id="table"></table>
</body>
</html>

Related Topics

Dependencies

jquery-1.4.4.js
infragistics.util.js

Copyright © 1996 - 2025 Infragistics, Inc. All rights reserved.

#