Fix sort bug
This commit is contained in:
parent
992918a65b
commit
297d54fdc1
@ -146,22 +146,22 @@ 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: 'count', name: 'Livre(s)' },
|
||||
{ id: 'authors', name: 'Auteur(s)' }
|
||||
{ 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: 'count', name: 'Livre(s)' }
|
||||
{ id: 'author_name', name: 'Nom', sort: 'name' },
|
||||
{ id: 'count', name: 'Livre(s)' }
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user