Keep entity list headings stationary over sort column changes

This commit is contained in:
David Rowe 2016-04-14 15:47:11 +12:00
parent 6e4c1a5a43
commit 08dd5c54c1
2 changed files with 14 additions and 8 deletions

View file

@ -834,6 +834,12 @@ textarea:enabled[scrolling="true"]::-webkit-resizer {
position: relative; /* New positioning context. */ position: relative; /* New positioning context. */
} }
#entity-list .sort-order {
display: inline-block;
width: 6px;
text-align: right;
}
#search-area { #search-area {
padding-right: 148px; padding-right: 148px;
padding-bottom: 24px; padding-bottom: 24px;

View file

@ -18,11 +18,11 @@
var entities = {}; var entities = {};
var selectedEntities = []; var selectedEntities = [];
var currentSortColumn = 'type'; var currentSortColumn = 'type';
var currentSortOrder = 'asc'; var currentSortOrder = 'des';
var entityList = null; var entityList = null;
var refreshEntityListTimer = null; var refreshEntityListTimer = null;
const ASCENDING_STRING = ' ▾'; const ASCENDING_STRING = '▾';
const DESCENDING_STRING = ' ▴'; const DESCENDING_STRING = '▴';
const DELETE = 46; // Key code for the delete key. const DELETE = 46; // Key code for the delete key.
const MAX_ITEMS = Number.MAX_VALUE; // Used to set the max length of the list of discovered entities. const MAX_ITEMS = Number.MAX_VALUE; // Used to set the max length of the list of discovered entities.
@ -146,14 +146,14 @@
if (currentSortColumn == column) { if (currentSortColumn == column) {
currentSortOrder = currentSortOrder == "asc" ? "desc" : "asc"; currentSortOrder = currentSortOrder == "asc" ? "desc" : "asc";
} else { } else {
elSortOrder[currentSortColumn].style.display = 'none'; elSortOrder[currentSortColumn].innerHTML = "";
elSortOrder[column].style.display = 'inline';
currentSortColumn = column; currentSortColumn = column;
currentSortOrder = "asc"; currentSortOrder = "asc";
} }
elSortOrder[column].innerHTML = currentSortOrder == "asc" ? ASCENDING_STRING : DESCENDING_STRING; elSortOrder[column].innerHTML = currentSortOrder == "asc" ? ASCENDING_STRING : DESCENDING_STRING;
entityList.sort(currentSortColumn, { order: currentSortOrder }); entityList.sort(currentSortColumn, { order: currentSortOrder });
} }
setSortColumn('type');
function refreshEntities() { function refreshEntities() {
clearEntities(); clearEntities();
@ -301,9 +301,9 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th id="entity-type" data-sort="type">Type <span class="sort-order" style="display: inline">&nbsp;&#x25BE;</span></th> <th id="entity-type" data-sort="type">Type <span class="sort-order"></span></th>
<th id="entity-name" data-sort="type">Name <span class="sort-order" style="display: none">&nbsp;&#x25BE;</span></th> <th id="entity-name" data-sort="type">Name <span class="sort-order"></span></th>
<th id="entity-url" data-sort="url">File <span class="sort-order" style="display: none">&nbsp;&#x25BE;</span></th> <th id="entity-url" data-sort="url">File <span class="sort-order"></span></th>
</tr> </tr>
</thead> </thead>
<tbody class="list" id="entity-table-body"> <tbody class="list" id="entity-table-body">