You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Vue.js grid component example</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
<script src="../../dist/vue.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- component template -->
|
|
<script type="text/x-template" id="grid-template">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th v-for="key in columns"
|
|
@click="sortBy(key)"
|
|
:class="{ active: sortKey == key }">
|
|
{{ capitalize(key) }}
|
|
<span class="arrow" :class="sortOrders[key] > 0 ? 'asc' : 'dsc'">
|
|
</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="entry in filteredData">
|
|
<td v-for="key in columns">
|
|
{{entry[key]}}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</script>
|
|
|
|
<!-- demo root element -->
|
|
<div id="demo">
|
|
<form id="search">
|
|
Search <input name="query" v-model="searchQuery">
|
|
</form>
|
|
<demo-grid
|
|
:data="gridData"
|
|
:columns="gridColumns"
|
|
:filter-key="searchQuery">
|
|
</demo-grid>
|
|
</div>
|
|
|
|
<script src="grid.js"></script>
|
|
|
|
</body>
|
|
</html>
|
|
|