Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Sorting rows alphabetically

1557926718
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
With the on:clicked  functionality now available. Is it possible to then use that plus appropriate code to sort a repeating section alphabetically?
1557936434
vÍnce
Pro
Sheet Author
I don't think so since sheet workers cannot affect the DOM in roll20.  ;-(  it would be handy to include a "sort" option in the repitem attributes we already have access to...
1557937293

Edited 1557937365
GiGs
Pro
Sheet Author
API Scripter
I dont think there's a way to do it automatically in a sheet worker. You could fake it, very laboriously. Have a sheet worker read the values in the repeating section, copy them all into an array of rows, and sort the rows using javascript. Then with setAttrs, overwrite the existing repeating section row values with the new order. Or delete all the existing rows and add new rows in the proper order. This will mess up any macros people have made linking to items in specific rows though. Since you won't actually be changing the order of the rows, just changing what each row contains.
1557937825
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
That sounds disappointing...maybe a new feature request?!
1557972197
Finderski
Pro
Sheet Author
Compendium Curator
SᵃᵛᵃǤᵉ said: That sounds disappointing...maybe a new feature request?!   Maybe, but don't hold your breath...improvements/enhancements for character sheets don't really get much love... :(