Pagination for missing is alive!

This commit is contained in:
Mark McDowall 2013-05-01 22:50:34 -07:00
commit b4242f9fb2
17 changed files with 235 additions and 22 deletions

View file

@ -4,10 +4,6 @@ define(['app', 'Series/EpisodeModel'], function () {
url : NzbDrone.Constants.ApiRoot + '/missing',
model : NzbDrone.Series.EpisodeModel,
comparator: function (model) {
return model.get('airDate');
},
state: {
pageSize: 10,
sortKey: "airDate",
@ -18,12 +14,24 @@ define(['app', 'Series/EpisodeModel'], function () {
totalPages: null,
totalRecords: null,
pageSize: 'pageSize',
sortKey: "sortBy",
order: "direction",
sortKey: "sortKey",
order: "sortDir",
directions: {
"-1": "asc",
"1": "desc"
}
},
parseState: function (resp, queryParams, state) {
return {totalRecords: resp.totalRecords};
},
parseRecords: function (resp) {
if (resp) {
return resp.records;
}
return resp;
}
});
});

View file

@ -13,7 +13,8 @@ define([
regions: {
missing: '#x-missing',
toolbar: '#x-toolbar'
toolbar: '#x-toolbar',
pager : '#x-pager'
},
showTable: function () {
@ -48,6 +49,12 @@ define([
editable : false,
cell : 'airDate',
headerCell: 'nzbDrone'
// headerCell: Backgrid.NzbDroneHeaderCell.extend({
// initialize: function(options) {
// this.constructor.__super__.initialize.apply(this, [options]);
// this.direction('descending');
// }
// })
},
{
name : 'edit',
@ -66,6 +73,13 @@ define([
collection: this.missingCollection,
className : 'table table-hover'
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: columns,
collection: this.missingCollection
}));
this.missingCollection.getFirstPage();
},
initialize: function () {

View file

@ -4,3 +4,8 @@
<div id="x-missing"></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="x-pager"></div>
</div>
</div>