1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-07-05 11:22:51 +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> <ol class="FeatAdvsearch breadcrumb" id="searchCrumb"></ol>
<div class="table-responsive-md"> <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> <thead>
<tr> <tr>
<th></th> <th></th>

View File

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