Skip to content
Snippets Groups Projects
Commit 75dcea39 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

no pagination if only one page, clic on page number and grey sort icons

parent 6986a8a0
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
<th class="center"> <th class="center">
Type Type
<i <i
:class="{ down: isSortedAsc('type'), up: isSortedDesc('type') }" :class="{
down: isSortedAsc('type'),
up: isSortedDesc('type'),
}"
class="icon sort" class="icon sort"
@click="changeSort('type')" @click="changeSort('type')"
/> />
...@@ -28,7 +31,10 @@ ...@@ -28,7 +31,10 @@
<th class="center"> <th class="center">
Nom Nom
<i <i
:class="{ down: isSortedAsc('nom'), up: isSortedDesc('nom') }" :class="{
down: isSortedAsc('nom'),
up: isSortedDesc('nom'),
}"
class="icon sort" class="icon sort"
@click="changeSort('nom')" @click="changeSort('nom')"
/> />
...@@ -138,8 +144,9 @@ ...@@ -138,8 +144,9 @@
</tbody> </tbody>
</table> </table>
<div <div
class="dataTables_info" v-if="nbPages.length > 1"
id="table-features_info" id="table-features_info"
class="dataTables_info"
role="status" role="status"
aria-live="polite" aria-live="polite"
> >
...@@ -148,22 +155,27 @@ ...@@ -148,22 +155,27 @@
sur {{ filteredFeatures.length }} éléments sur {{ filteredFeatures.length }} éléments
</div> </div>
<div <div
class="dataTables_paginate paging_simple_numbers" v-if="nbPages.length > 1"
id="table-features_paginate" id="table-features_paginate"
class="dataTables_paginate paging_simple_numbers"
> >
<a <a
@click="toPreviousPage" @click="toPreviousPage"
class="paginate_button previous disabled" id="table-features_previous"
:class="[
'paginate_button previous',
{ disabled: pagination.currentPage === 1 },
]"
aria-controls="table-features" aria-controls="table-features"
data-dt-idx="0" data-dt-idx="0"
tabindex="0" tabindex="0"
id="table-features_previous"
>Précédent</a >Précédent</a
> >
<span> <span>
<a <a
v-for="pageNumber in nbPages" v-for="pageNumber in nbPages"
:key="'page' + pageNumber" :key="'page' + pageNumber"
@click="toPage(pageNumber)"
:class="[ :class="[
'paginate_button', 'paginate_button',
{ current: pageNumber === pagination.currentPage }, { current: pageNumber === pagination.currentPage },
...@@ -176,11 +188,14 @@ ...@@ -176,11 +188,14 @@
</span> </span>
<!-- // TODO : <span v-if="nbPages > 4" class="ellipsis">...</span> --> <!-- // TODO : <span v-if="nbPages > 4" class="ellipsis">...</span> -->
<a <a
class="paginate_button next" id="table-features_next"
:class="[
'paginate_button next',
{ disabled: pagination.currentPage === nbPages.length },
]"
aria-controls="table-features" aria-controls="table-features"
data-dt-idx="7" data-dt-idx="7"
tabindex="0" tabindex="0"
id="table-features_next"
@click="toNextPage" @click="toNextPage"
>Suivant</a >Suivant</a
> >
...@@ -258,12 +273,10 @@ export default { ...@@ -258,12 +273,10 @@ export default {
let N = Math.round( let N = Math.round(
this.filteredFeatures.length / this.pagination.pagesize this.filteredFeatures.length / this.pagination.pagesize
); );
console.log("N", N);
const arr = [...Array(N).keys()].map(function (x) { const arr = [...Array(N).keys()].map(function (x) {
++x; ++x;
return x; return x;
}); });
console.log("arr", arr);
return arr; return arr;
}, },
...@@ -296,6 +309,14 @@ export default { ...@@ -296,6 +309,14 @@ export default {
} }
}, },
toPage(pageNumber) {
const toAddOrRemove =
(pageNumber - this.pagination.currentPage) * this.pagination.pagesize;
this.pagination.start += toAddOrRemove;
this.pagination.end += toAddOrRemove;
this.pagination.currentPage = pageNumber;
},
toPreviousPage() { toPreviousPage() {
if (this.pagination.start > 0) { if (this.pagination.start > 0) {
this.pagination.start -= this.pagination.pagesize; this.pagination.start -= this.pagination.pagesize;
...@@ -369,6 +390,24 @@ export default { ...@@ -369,6 +390,24 @@ export default {
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 2px; border-radius: 2px;
} }
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
color: white !important;
border: 1px solid #111;
background-color: #585858;
background: -webkit-gradient(
linear,
left top,
left bottom,
color-stop(0%, #585858),
color-stop(100%, #111)
);
background: -webkit-linear-gradient(top, #585858 0%, #111 100%);
background: -moz-linear-gradient(top, #585858 0%, #111 100%);
background: -ms-linear-gradient(top, #585858 0%, #111 100%);
background: -o-linear-gradient(top, #585858 0%, #111 100%);
background: linear-gradient(to bottom, #585858 0%, #111 100%);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active { .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
cursor: default; cursor: default;
...@@ -378,6 +417,10 @@ export default { ...@@ -378,6 +417,10 @@ export default {
box-shadow: none; box-shadow: none;
} }
i.icon.sort:not(.down):not(.up) {
color: rgb(220, 220, 220);
}
/* /*
Max width before this PARTICULAR table gets nasty Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px This query will take effect for any screen smaller than 760px
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment