ENH: Support table pagination (#24)

Fixes #22
This commit is contained in:
Matthew Ryan Dillon 2017-09-23 14:35:50 -07:00 committed by GitHub
parent 8309486a8a
commit 578b8daa32
11 changed files with 131 additions and 8 deletions

View file

@ -1 +1 @@
{{collections-container model=model}}
{{collections-container model=model changePage=(action 'changePage')}}

View file

@ -0,0 +1,35 @@
<div class="row">
<div class="col-md-6 table-nav">
<ul class="pager pull-left">
{{#if notOnFirst}}
<li><a {{action (action changePage first)}}>First</a></li>
{{else}}
<li class="disabled"><a>First</a></li>
{{/if}}
{{#if prev}}
<li><a {{action (action changePage prev)}}>Previous</a></li>
{{else}}
<li class="disabled"><a>Previous</a></li>
{{/if}}
{{#if next}}
<li><a {{action (action changePage next)}}>Next</a></li>
{{else}}
<li class="disabled"><a>Next</a></li>
{{/if}}
{{#if notOnLast}}
<li><a {{action (action changePage last)}}>Last</a></li>
{{else}}
<li class="disabled"><a>Last</a></li>
{{/if}}
</ul>
</div>
<div class="col-md-6">
<div class="pull-right table-stats">
<span class="label label-default">Current Page: {{currentPage}}</span>
<span class="label label-default">Total Records: {{totalRecords}}</span>
</div>
</div>
</div>

View file

@ -1,8 +1,10 @@
{{#if hasBlock}}
{{yield (hash
table=(component 'light-table' table=table)
pagination=(component 'ccdb-pagination' model=model changePage=(action changePage))
)}}
{{else}}
{{ccdb-pagination model=model changePage=(action changePage)}}
{{#light-table table tableClassNames="table table-striped" as |t|}}
{{t.head}}
{{t.body}}

View file

@ -1 +1 @@
{{ccdb-table model=model columns=columns}}
{{ccdb-table model=model columns=columns changePage=(action changePage)}}