Make new columns sortable

This commit is contained in:
David Rowe 2016-08-26 17:56:23 +12:00
parent 6de335e1b1
commit f55d1f7ce7
2 changed files with 32 additions and 8 deletions

View file

@ -56,12 +56,12 @@
<th id="entity-url">File<span class="sort-order"></span></th>
<th id="entity-locked"><span class="glyph">&#xe006;</span><span class="sort-order"></span></th>
<th id="entity-visible"><span class="glyph">&#xe007;</span><span class="sort-order"></span></th>
<th id="entity-verticesCount">Verts</th>
<th id="entity-texturesCount">Texts</th>
<th id="entity-texturesSize">T Size</th>
<th id="entity-hasTransparent"><span class="glyph">'</span></th>
<th id="entity-drawCalls">Draws</th>
<th colspan="2" id="entity-hasScript"><span class="glyph">Q</span></th>
<th id="entity-verticesCount">Verts<span class="sort-order"></span></th>
<th id="entity-texturesCount">Texts<span class="sort-order"></span></th>
<th id="entity-texturesSize">T Size<span class="sort-order"></span></th>
<th id="entity-hasTransparent"><span class="glyph">'</span><span class="sort-order"></span></th>
<th id="entity-drawCalls">Draws<span class="sort-order"></span></th>
<th colspan="2" id="entity-hasScript"><span class="glyph">Q</span><span class="sort-order"></span></th>
</tr>
</thead>
<tbody class="list" id="entity-table-body">

View file

@ -57,7 +57,25 @@ function loaded() {
document.getElementById("entity-visible").onclick = function () {
setSortColumn('visible');
};
document.getElementById("entity-verticesCount").onclick = function () {
setSortColumn('verticesCount');
};
document.getElementById("entity-texturesCount").onclick = function () {
setSortColumn('texturesCount');
};
document.getElementById("entity-texturesSize").onclick = function () {
setSortColumn('texturesSize');
};
document.getElementById("entity-hasTransparent").onclick = function () {
setSortColumn('hasTransparent');
};
document.getElementById("entity-drawCalls").onclick = function () {
setSortColumn('drawCalls');
};
document.getElementById("entity-hasScript").onclick = function () {
setSortColumn('hasScript');
};
function onRowClicked(clickEvent) {
var id = this.dataset.entityId;
var selection = [this.dataset.entityId];
@ -156,7 +174,13 @@ function loaded() {
type: document.querySelector('#entity-type .sort-order'),
url: document.querySelector('#entity-url .sort-order'),
locked: document.querySelector('#entity-locked .sort-order'),
visible: document.querySelector('#entity-visible .sort-order')
visible: document.querySelector('#entity-visible .sort-order'),
verticesCount: document.querySelector('#entity-verticesCount .sort-order'),
texturesCount: document.querySelector('#entity-texturesCount .sort-order'),
texturesSize: document.querySelector('#entity-texturesSize .sort-order'),
hasTransparent: document.querySelector('#entity-hasTransparent .sort-order'),
drawCalls: document.querySelector('#entity-drawCalls .sort-order'),
hasScript: document.querySelector('#entity-hasScript .sort-order'),
}
function setSortColumn(column) {
if (currentSortColumn == column) {