Fixed table header cell

pull/3113/head
Mark McDowall 10 years ago
parent ed4bf349db
commit 85f6d90f40

@ -1,9 +1,9 @@
var Backgrid = require('backgrid'); module.exports.register = function(backgrid) {
backgrid.SonarrHeaderCell = backgrid.HeaderCell.extend({
module.exports = (function(){ events : {
Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({ 'click' : 'onClick'
events : {"click" : 'onClick'}, },
_originalInit : Backgrid.HeaderCell.prototype.initialize, _originalInit : backgrid.HeaderCell.prototype.initialize,
initialize : function(options){ initialize : function(options){
this._originalInit.call(this, options); this._originalInit.call(this, options);
this.listenTo(this.collection, 'drone:sort', this.render); this.listenTo(this.collection, 'drone:sort', this.render);
@ -12,7 +12,7 @@ module.exports = (function(){
this.$el.empty(); this.$el.empty();
this.$el.append(this.column.get('label')); this.$el.append(this.column.get('label'));
var column = this.column; var column = this.column;
var sortable = Backgrid.callByNeed(column.sortable(), column, this.collection); var sortable = backgrid.callByNeed(column.sortable(), column, this.collection);
if(sortable) { if(sortable) {
this.$el.addClass('sortable'); this.$el.addClass('sortable');
this.$el.append(' <i class="pull-right"></i>'); this.$el.append(' <i class="pull-right"></i>');
@ -68,7 +68,7 @@ module.exports = (function(){
var collection = this.collection; var collection = this.collection;
var event = 'backgrid:sort'; var event = 'backgrid:sort';
var column = this.column; var column = this.column;
var sortable = Backgrid.callByNeed(column.sortable(), column, collection); var sortable = backgrid.callByNeed(column.sortable(), column, collection);
if(sortable) { if(sortable) {
var direction = collection.state.order; var direction = collection.state.order;
if(direction === 'ascending' || direction === -1) { if(direction === 'ascending' || direction === -1) {
@ -109,5 +109,4 @@ module.exports = (function(){
this.$el.children('i').removeClass('icon-sort-up icon-sort-down'); this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
} }
}); });
return Backgrid.NzbDroneHeaderCell; };
}).call(this);

@ -2,7 +2,6 @@ var $ = require('jquery');
module.exports = { module.exports = {
appInitializer : function(){ appInitializer : function(){
console.log('starting signalR');
$('body').tooltip({selector : '[title]'}); $('body').tooltip({selector : '[title]'});
return this; return this;
} }

@ -2,7 +2,12 @@ require('../JsLibraries/backbone.backgrid');
require('backbone'); require('backbone');
require('backbone'); require('backbone');
var backgrid = require('../JsLibraries/backbone.backgrid'); var backgrid = require('../JsLibraries/backbone.backgrid');
var header = require('../Shared/Grid/HeaderCell');
header.register(backgrid);
backgrid.Column.prototype.defaults = { backgrid.Column.prototype.defaults = {
name : undefined, name : undefined,
label : undefined, label : undefined,
@ -11,6 +16,7 @@ backgrid.Column.prototype.defaults = {
renderable : true, renderable : true,
formatter : undefined, formatter : undefined,
cell : undefined, cell : undefined,
headerCell : 'Sonarr',
sortType : 'toggle' sortType : 'toggle'
}; };
module.exports = backgrid; module.exports = backgrid;
Loading…
Cancel
Save