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

Help with setSectionOrder

So I'm trying to work on a complex repeating section that care about the order of the elements within it. Depending on the circumstance, I need to re-arrange the elements within it, but, as the wiki says, setSectionOrder brings about a bunch of visual bugs. I have a work around for now, but it definitely makes everything a bit jank.  Is there any advice about how to avoid problems with this function out there? 
1671401244

Edited 1671401278
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
setSectionOrder  is a real pain to use. I've got a sheet, the official Scion sheet, that uses it and has some work arounds for the problem, but I'm not even entirely sure which of the 4ish(?) work arounds in there finally solved the problem. Things that I can recommend trying: Force a rerender of another repeating section that is currently being displayed on the page     Set the value of an input that controls the layout of another repeating section and then reset it back to it's original value in the callback to setAttrs. Reset the values of the rows in the affected repeating section As the above option, but now you're working on the actual repeating section that you are reorganizing I can't guarantee that either of those will work. By the time I finally got it to work for my sheet I had become frustrated enough that I wasn't keeping the best track of what all I had tried.
1671423464

Edited 1671426546
Is is the official Scion on roll20's git? I was looking and didn't see a single setSectionOrder. Though it might be hiding from me since my knowledge of js is a bit lacking. [edit] Also, just to confirm, by "controls the layout of another section" do you mean a hidden input and then display: none; in the css? 
1671427996

Edited 1671428050
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, technically, the official storypath sheet, but it's really the scion sheet. Looks like I actually did comments in there, so you can find my work around function starting on line 3977 .