ig.FunctionDataSource

ig.FunctionDataSource_image

The FunctionDataSource extends the DataSource class and sets the type option to 'function' by default. For more details on the RemoteDataSource component’s API, refer to the base DataSource component’s API documentation. 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 FunctionDataSource 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 FunctionDataSource 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;
        var render = function (success, error) {
            if (success) {
          var template = "<tr><td>${CurrencyCode}</td><td>${Name}</td><td>${ModifiedDate}</td></tr>",
          resultHtml = $.ig.tmpl(template, ds.dataView());
          $("#table").html(resultHtml);
            } else {
                alert(error);
            }
        };
         
        var myDataSource = function () {
            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"],
            ];
             
            return arrayOfArraysData;
        };
  
        var arraySchema = new $.ig.DataSchema("array", {
            fields: [{
                name: "CurrencyCode",
                type: "string"
            }, {
                name: "Name",
                type: "string"
            }, {
                name: "ModifiedDate",
                type: "string"
            }]
        });
  
        $(function () {
            ds = new $.ig.FunctionDataSource({
                dataSource: myDataSource,
                schema: arraySchema,
                callback: render
            });
  
            ds.dataBind();
        });
    </script>
</head>
<body>
    <table id="table"></table>
</body>
</html>

Dependencies

jquery.js
infragistics.util.js
infragistics.util.jquery.js

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