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. */
}
#entity-list .sort-order {
display: inline-block;
width: 6px;
text-align: right;
}
#search-area {
padding-right: 148px;
padding-bottom: 24px;

View file

@ -18,11 +18,11 @@
var entities = {};
var selectedEntities = [];
var currentSortColumn = 'type';
var currentSortOrder = 'asc';
var currentSortOrder = 'des';
var entityList = null;
var refreshEntityListTimer = null;
const ASCENDING_STRING = ' ▾';
const DESCENDING_STRING = ' ▴';
const ASCENDING_STRING = '▾';
const DESCENDING_STRING = '▴';
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.
@ -146,14 +146,14 @@
if (currentSortColumn == column) {
currentSortOrder = currentSortOrder == "asc" ? "desc" : "asc";
} else {
elSortOrder[currentSortColumn].style.display = 'none';
elSortOrder[column].style.display = 'inline';
elSortOrder[currentSortColumn].innerHTML = "";
currentSortColumn = column;
currentSortOrder = "asc";
}
elSortOrder[column].innerHTML = currentSortOrder == "asc" ? ASCENDING_STRING : DESCENDING_STRING;
entityList.sort(currentSortColumn, { order: currentSortOrder });
}
setSortColumn('type');
function refreshEntities() {
clearEntities();
@ -301,9 +301,9 @@
</colgroup>
<thead>
<tr>
<th id="entity-type" data-sort="type">Type <span class="sort-order" style="display: inline">&nbsp;&#x25BE;</span></th>
<th id="entity-name" data-sort="type">Name <span class="sort-order" style="display: none">&nbsp;&#x25BE;</span></th>
<th id="entity-url" data-sort="url">File <span class="sort-order" style="display: none">&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"></span></th>
<th id="entity-url" data-sort="url">File <span class="sort-order"></span></th>
</tr>
</thead>
<tbody class="list" id="entity-table-body">