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

[Question] Can you sort a fieldset?

1494790543
Havoc
Sheet Author
API Scripter
Is it possible with SheetWorker to sort a fieldset? Or maybe API?
1494797567
Jakob
Sheet Author
API Scripter
Havoc said: Is it possible with SheetWorker to sort a fieldset? Or maybe API? Yes, you can write a comma-separated list of sectionIDs into the _reporder_repeating_foo attribute to sort the section repeating_foo (You can do this via the API too). The actual display on the sheet will not update until the sheet is reopened (but there may be a way to force a refresh).
1494859390

Edited 1494859401
Kryx
Pro
Sheet Author
API Scripter
You can also read and store all items in the repeating section, delete all items in the repeating section, sort the items, and re-add them. It would not require a refresh, but IDs would be lost.
1494861550

Edited 1494864598
Havoc
Sheet Author
API Scripter
Sorry to ask, but do you have an example code maybe? I'm not that good with javascript. What I want to achieve is that the player has a list of rolls (name, attribute, ability) and he would need to able to choose by which column he wants to sort (and the direction). 
1495723471
Havoc
Sheet Author
API Scripter
Anybody tried it before? With a Sheet Worker? Please, I just need a working example.