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;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue