Hello all,
I have created a Userscript that is called from one of my Templater Templates.
My user script returns an array of items. and my template shows these items in a suggester dropdownlist.
Is there a way I can sort these items in the dropdown?
I tried the normal JS .sort() and a few other ideas I had.
I know I could recreate the array alphabetically but if it gets big that would be a Huge pain!
There should be some way to sort this.
Here is my function.
async function chooseColor(tp) {
const colors =
[
'orange',
'yellow', 'yyellow',
'gray', ' ', '', 'none',
'blue','bblue','cyan',
'green', 'ggreen', 'sqlgreen', 'comment',
'red', 'rred', 'sqlred',
'purple', 'ppurple',
'pink', 'ppink', 'sqlpink',
'vsaction', 'vshelper', 'vspink',
'gold', 'silver', 'litesilver',
'brown'
];
return await tp.system.suggester(colors, colors, false, 'Color');
}
Thank you.