Available in the OSS Version

Templating Engine - TypeScript

Show
records
DenzelWashington USA
AngelinaJolie USA
PenelopeCruz Spain
First NameLast NameNationalityMovies

This sample is designed for a larger screen size.

On mobile, try rotating your screen, view full size, or email to another device.

This sample demonstrates how to use nested templates using the Infragistics Templating Engine in TypeScript. In this example the movies collection for each actor is iterated through and a Tree is used to display the movies data.

Code View

Copy to Clipboard
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <!-- Ignite UI for jQuery Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

    <!-- Ignite UI for jQuery Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.lob.js"></script>

    <style type="text/css">
        .clear {
            clear: both;
        }

        .ui-igrating {
            float: left;
        }

        .ratingLabel {
            float: left;
            margin-left: 3px;
            margin-right: 5px;
        }
        .delete-button
        {
            width: 100%;
            font-size: 1em;
            border: solid 1px #777;
            font-family: 'Segoe UI', Arial, sans-serif;
            color: #444;
        }
        .delete-button:hover
        {
            background-color: #d0edfa;
        }
    </style>

</head>
<body>
    <script id="colTmpl" type="text/template">
        <div class='tree'>
            <ul>
                {{each ${movies} }}
                <li>
                    ${movies.name}
                    <ul>
                        <li>Genre: ${movies.genre}</li>
                        <li>Year: ${movies.year}</li>
                        <li>
                            <a>
                                <span class='ratingLabel' style='float:left'>Rating:</span>
                                <span class='rating'>${movies.rating}</span>
                            </a>
                        </li>
                        <li class='clear'>Languages: ${movies.languages}</li>
                        <li>Subtitles: ${movies.subtitles}</li>
                    </ul>
                    {{/each}}
            </ul>
        </div>
    </script>

    <div id="resultGrid"></div>
    <script src="/TypeScriptSamples/templating-engine/typescript.js"></script>
</body>
</html>