en.javascript.info/2-ui/5-widgets/4-template-lodash/1-table-template/source.view/index.html
2015-02-21 00:59:02 +03:00

31 lines
707 B
HTML
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.2.0/lodash.js"></script>
</head>
<body>
<div id="grid-holder"></div>
<script type="text/template" id="grid-template">
..ваш шаблон..
</script>
<script>
var users = [
{name: "Вася", age: 10},
{name: "Петя", age: 15},
{name: "Женя", age: 20},
{name: "Маша", age: 25},
{name: "Даша", age: 30},
];
// ваш код, чтобы сгенерировать таблицу с юзерами (table/tr/td) по шаблону и данным users
// выведите таблицу внутри #grid-holder
</script>
</body>
</html>