ig.HtmlTableDataSource

ig.HtmlTableDataSource_image

The HtmlTableDataSource extends the DataSource class and sets the type option to 'htmlTableDom' by default. For more details on the HtmlTableDataSource component’s API, refer to the 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 HtmlTableDataSource 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 HtmlTableDataSource 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">
        $(function () {
 
            var tableSchema = new $.ig.DataSchema("htmlTableDom",
            { fields:
                [
                    { name: "FirstName" },
                    { name: "LastName" },
                    { name: "Email" }
                ]
            });
 
            var data = $("#tableData")[0];
 
            var ds = new $.ig.HtmlTableDataSource({
                dataSource: data,
                schema: tableSchema
            });
 
            ds.dataBind();
            var template = "<tr><td>${Email}</td><td>${FirstName}</td><td>${LastName}</td></tr>",
            resultHtml = $.ig.tmpl(template, ds.dataView());
            $("#t1").html(resultHtml);
        });
    </script>
</head>
<body>
    <h2>Source HTML</h2>
    <table id="tableData">
        <tr>
            <td>Gustavo</td>
            <td>Achong</td>
            <td>gustavo@adventure-works.com</td>
        </tr>
        <tr>
            <td>Catherine</td>
            <td>Abel</td>
            <td>catherine0@adventure-works.com</td>
        </tr>
        <tr>
            <td>Kim</td>
            <td>Abercrombie</td>
            <td>kim2@adventure-works.com</td>
        </tr>
    </table>
    <h2>Templated Schema</h2>
    <table id="t1" class="standard-grid">
        <thead></thead>
        <tbody></tbody>
    </table>
</body>
</html>

Related Samples

Related Topics

Dependencies

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

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