mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Unit list v0.0.0.0.1 done.
This commit is contained in:
@@ -2,7 +2,6 @@ export class UnitDataTable {
|
||||
|
||||
#element;
|
||||
#tableId = "unit-data-table";
|
||||
#hasUpdated = false;
|
||||
|
||||
|
||||
constructor() {
|
||||
@@ -28,13 +27,27 @@ export class UnitDataTable {
|
||||
}
|
||||
|
||||
|
||||
hide() {
|
||||
this.getElement()?.closest( ".ol-dialog" )?.classList.add( "hide" );
|
||||
}
|
||||
|
||||
|
||||
refresh( units:object ) {
|
||||
|
||||
if ( this.#hasUpdated ) {
|
||||
return;
|
||||
}
|
||||
const unitsArray = Object.values( units ).sort( ( a, b ) => {
|
||||
|
||||
const unitsArray = Object.values( units );
|
||||
const aVal = a.baseData.unitName.toLowerCase();
|
||||
const bVal = b.baseData.unitName.toLowerCase();
|
||||
|
||||
if ( aVal > bVal ) {
|
||||
return 1;
|
||||
} else if ( bVal > aVal ) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function addRow( parentEl:HTMLElement, columns:string[] ) {
|
||||
@@ -75,8 +88,16 @@ export class UnitDataTable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.#hasUpdated = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
show() {
|
||||
this.getElement()?.closest( ".ol-dialog" )?.classList.remove( "hide" );
|
||||
}
|
||||
|
||||
|
||||
toggle() {
|
||||
this.getElement()?.closest( ".ol-dialog" )?.classList.toggle( "hide" );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user