mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Sort number column
This commit is contained in:
parent
a391470ad0
commit
fc3db9b5b1
2 changed files with 6 additions and 4 deletions
|
|
@ -437,11 +437,13 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
const newOrder = [...itemList].reverse().sort((a, b) => {
|
||||
const aProp = a.querySelector(`[data-item-key="${key}"]`),
|
||||
bProp = b.querySelector(`[data-item-key="${key}"]`);
|
||||
bProp = b.querySelector(`[data-item-key="${key}"]`),
|
||||
aValue = isNaN(aProp.innerText) ? aProp.innerText : Number(aProp.innerText),
|
||||
bValue = isNaN(bProp.innerText) ? bProp.innerText : Number(bProp.innerText);
|
||||
if (type === 'DESC') {
|
||||
return aProp.innerText < bProp.innerText ? 1 : -1;
|
||||
return aValue < bValue ? 1 : -1;
|
||||
} else {
|
||||
return aProp.innerText > bProp.innerText ? 1 : -1;
|
||||
return aValue > bValue ? 1 : -1;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
<div class="item-list-img"></div>
|
||||
<div class="item-list-name" data-sort-key="name" data-sort-type="ASC" data-action="sortList">{{localize 'DAGGERHEART.UI.ItemBrowser.columnName'}}</div>
|
||||
{{#each menu.data.columns}}
|
||||
<span data-sort-key="{{key}}" data-sort-type="" data-action="sortList">{{localize label}}</span>
|
||||
<div data-sort-key="{{key}}" data-sort-type="" data-action="sortList">{{localize label}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue