1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-07-03 18:43:01 +00:00

Fix: sortorder on app startup

This commit is contained in:
jcorporation 2019-01-18 21:57:49 +00:00
parent 34c46d3eb4
commit 353551b05f
2 changed files with 18 additions and 12 deletions

View File

@ -570,7 +570,7 @@
<ol class="FeatAdvsearch breadcrumb" id="searchCrumb"></ol>
<div class="table-responsive-md">
<table id="SearchList" class="table table-hover table-sm" data-sort="">
<table id="SearchList" class="table table-hover table-sm">
<thead>
<tr>
<th></th>

View File

@ -1207,8 +1207,6 @@ function filterCols(x) {
}
function parseSettings() {
settingsParsed = false;
toggleBtn('btnRandom', settings.random);
toggleBtn('btnConsume', settings.consume);
toggleBtn('btnSingle', settings.single);
@ -1309,7 +1307,7 @@ function parseSettings() {
app.apps.Browse.tabs.Database.active = settings.tags[0];
}
if (settings.tags.includes('Title')) {
app.apps.Search.sort = 'Title';
app.apps.Search.state = '0/any/Title/';
}
document.getElementById('selectJukeboxMode').value = settings.jukeboxMode;
@ -1429,14 +1427,23 @@ function setCols(table, className) {
}
document.getElementById(table + 'ColsDropdown').firstChild.innerHTML = tagChks;
//var sort = document.getElementById('SearchList').getAttribute('data-sort');
if (app.current.sort == '-') {
if (settings.featTags)
app.current.sort = 'Title';
else
app.current.sort = 'Filename';
var sort = app.current.sort;
if (table == 'Search') {
if (app.apps.Search.state == '0/any/Title/') {
if (settings.tags.includes('Title')) {
sort = 'Title';
}
else if (settings.featTags == false) {
sort = 'Filename';
}
else {
sort = '-';
}
}
}
if (table != 'Playback') {
var heading = '';
for (var i = 0; i < settings['cols' + table].length; i++) {
@ -1446,11 +1453,10 @@ function setCols(table, className) {
h = '#';
heading += h;
if (table == 'Search' && h == sort ) {
if (table == 'Search' && (h == sort || '-' + h == sort) ) {
var sortdesc = false;
if (app.current.sort.indexOf('-') == 0) {
sortdesc = true;
//sort = sort.substring(1);
}
heading += '<span class="sort-dir material-icons pull-right">' + (sortdesc == true ? 'arrow_drop_up' : 'arrow_drop_down') + '</span>';
}