Fix sort bug

This commit is contained in:
Meutel 2017-08-05 20:11:15 +02:00
parent 992918a65b
commit 297d54fdc1
2 changed files with 8 additions and 8 deletions

View File

@ -146,21 +146,21 @@ var index = new Vue({
switch (type) {
case 'books':
this.cols = [
{ id: 'title', name: 'Titre', sortable: true },
{ id: 'title', name: 'Titre', sort: 'title' },
{ id: 'authors', name: 'Auteur(s)' },
{ id: 'series', name: 'Serie' }
];
break;
case 'series':
this.cols = [
{ id: 'serie_name', name: 'Nom', sortable: true },
{ id: 'serie_name', name: 'Nom', sort: 'name' },
{ id: 'count', name: 'Livre(s)' },
{ id: 'authors', name: 'Auteur(s)' }
];
break;
case 'authors':
this.cols = [
{ id: 'author_name', name: 'Nom', sortable: true },
{ id: 'author_name', name: 'Nom', sort: 'name' },
{ id: 'count', name: 'Livre(s)' }
];
break;

View File

@ -18,8 +18,8 @@
<tbody>
<tr>
<th v-for="col in cols">
<template v-if="col.sortable">
<a href="#" @click="sortBy(col.id)">{{ "{{" }}col.name{{ "}}" }}</a>
<template v-if="col.sort">
<a href="#" @click="sortBy(col.sort)">{{ "{{" }}col.name{{ "}}" }}</a>
<span v-if="sort_by == col.id" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</template>
<template v-else>{{ "{{" }}col.name{{ "}}" }}</template>