Advertisement Create a free account

Sorting rows alphabetically

1557926718
SᵃᵛᵃǤᵉ
Pro
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
Vince
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
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ᵃᵛᵃǤᵉ
Pro
Sheet Author
API Scripter
That sounds disappointing...maybe a new feature request?!
1557972197
Finderski
Pro
Sheet Author
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... :(