Currently I try to reevaluate my "enabled" property but its not re-computed after I change either pages or pageIndex.
page.js
export class Test {
pageIndex = 0;
pages = 2;
constructor() {
this.items = [
{title:"Prev.", enabled:this.prevAvailable},
{title:"Next", enabled:this.nextAvailable}
];
}
get prevAvailable() {
return this.pageIndex > 0;
}
get nextAvailable}() {
return this.pageIndex < this.pages;
}
}
page.html
<template>
<ul>
<li repeat.for="item of items">
<button if.bind="item.enabled">
${item.title}
</button>
</li>
</ul>
</template>
How is the normal way to achive this behaviour for a standard paging control? I try to disable the "next" button if on last page.
I appreciate any help.
Here's the pager custom element I used in this project (scroll to bottom to see the pager).
pager.html
pager.js
Here's how the pager element is used:
order-list.html
EDIT 10/14/2015
Here's a bootstrap pager- works a little differently but it's usage is the same, no view-model required: