Copy link to clipboard
Copied
I have some listboxes whose items are filled in by a script and/or via a CSV.
1. I would like items containing "T*T" to appear at the top of the list, sorted alphabetically. (As this word is censored by the forum I wrote it "T * T", you can see it on the screenshot)
2. I would like items containing "ADE" (and not containing "T*T") to appear next, sorted alphabetically.
3. And I would like all the other items to appear after, sorted alphabetically.
See screenshot: white list is the current, yellow list is what I want.
Is it possible?
Copy link to clipboard
Copied
Sort the items before you add it to the listbox.
Copy link to clipboard
Copied
I cannot, items are sometimes added in several times by multiple scripts.
Copy link to clipboard
Copied
Then get the items from the listbox, sort the items, and add the items to the listbox.
Copy link to clipboard
Copied
Thank you.
Copy link to clipboard
Copied
Hi JR, here's a 30sec script
var oFld = this.getField("List1");
var len = oFld.numItems;
var aItems = [];
for(var i=0;i<len;i++)
aItems.push([oFld.getItemAt(i,false),oFld.getItemAt(i,true)]);
oFld.setItems(aItems.sort())
Copy link to clipboard
Copied
Thank you Thom!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now