mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
Sorting on all series views is now working
New: Sorting is now persisted on a per page and browser basis New: Series lists now support sorting on all views
This commit is contained in:
parent
4d6d477947
commit
6ba17782aa
13 changed files with 414 additions and 123 deletions
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
['Config'],
|
||||
function (Config) {
|
||||
['underscore', 'Config'],
|
||||
function (_, Config) {
|
||||
|
||||
return function () {
|
||||
|
||||
|
@ -22,7 +22,8 @@ define(
|
|||
|
||||
_setInitialState.call(this);
|
||||
|
||||
this.on('backgrid:sort', _storeState, this);
|
||||
this.on('backgrid:sort', _storeStateFromBackgrid, this);
|
||||
this.on('drone:sort', _storeState, this);
|
||||
|
||||
if (originalInit) {
|
||||
originalInit.call(this, options);
|
||||
|
@ -38,9 +39,17 @@ define(
|
|||
this.state.order = order;
|
||||
};
|
||||
|
||||
var _storeState = function (column, sortDirection) {
|
||||
var _storeStateFromBackgrid = function (column, sortDirection) {
|
||||
var order = _convertDirectionToInt(sortDirection);
|
||||
var sortKey = column.has('sortValue') ? column.get('sortValue') : column.get('name');
|
||||
var sortKey = column.has('sortValue') && _.isString(column.get('sortValue')) ? column.get('sortValue') : column.get('name');
|
||||
|
||||
Config.setValue('{0}.sortKey'.format(this.tableName), sortKey);
|
||||
Config.setValue('{0}.sortDirection'.format(this.tableName), order);
|
||||
};
|
||||
|
||||
var _storeState = function (sortModel, sortDirection) {
|
||||
var order = _convertDirectionToInt(sortDirection);
|
||||
var sortKey = sortModel.get('name');
|
||||
|
||||
Config.setValue('{0}.sortKey'.format(this.tableName), sortKey);
|
||||
Config.setValue('{0}.sortDirection'.format(this.tableName), order);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue