summaryrefslogtreecommitdiffstats
path: root/web/js/labitrack.d/43-browse.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/labitrack.d/43-browse.js')
-rw-r--r--web/js/labitrack.d/43-browse.js43
1 files changed, 11 insertions, 32 deletions
diff --git a/web/js/labitrack.d/43-browse.js b/web/js/labitrack.d/43-browse.js
index 7605e78..14399ac 100644
--- a/web/js/labitrack.d/43-browse.js
+++ b/web/js/labitrack.d/43-browse.js
@@ -1,4 +1,5 @@
(function(){
+
function hdl_add(){
console.log('add');
}
@@ -41,39 +42,14 @@
messages.bind("remove", hdl_remove, this);
},
render: function(page){
+ if (page) this.page = page;
+ page = this.page;
var stats = this.collection.stats;
var pages = [];
- var dots = { id: 'dots', label: '…' };
- pages.push({
- id: 'first',
- link: '/browse',
- label: '|←',
- classes: 'prev'
- });
- pages.push({
- id: 'prev',
- link: '/browse',
- label: '←'
- });
- pages.push(dots);
- pgno = 1;
- pages.push({
- id: pgno,
- link: '/browse/'+pgno,
- label: pgno
- });
- pages.push(dots);
- pages.push({
- id: 'next',
- link: '/browse',
- label: '→'
- });
- pages.push({
- id: 'last',
- link: '/browse',
- label: '→|',
- classes: 'next'
- });
+ if (stats !== undefined) {
+ var pgcnt = Math.ceil(stats.count / 10);
+ pages = λ.pagination(page, pgcnt);
+ }
var data = {
rows: this.collection.toJSON(),
pages: pages
@@ -92,13 +68,16 @@
},
render: function (page) {
page || (page = 1);
+ page = parseInt(page, 10);
+ console.log('page', page);
λ.setcontent('browse', {page: page});
this.browse.el = $(this.el).find('#objecttable_ph')[0];
+ console.log(this.browse.render);
this.browse.render(page);
this.browse.collection.fetchpage(page);
}
});
view.route('browse');
- view.route('browse/:page');
+ view.route('browse/page/:page');
}());