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

Repeating section add-order

Is it possible to configure a repeating section to add new rows at the top instead of the bottom? If this is would require a sheet worker, could someone show me how? Thanks!
1642606344
Finderski
Plus
Sheet Author
Compendium Curator
In your CSS add something like this: .repcontainer { display: flex; flex-flow: column; flex-direction: column-reverse; } I've never actually tried this in a sheet's CSS, but it works in the dev console, so I'd assume it'll work for this. If you don't want it like this for all the repeating sections, you may need to modify the top line to something like: .repcontainer[datagroup="repeating_<your repeating section name>" {
1642612731
Finderski
Plus
Sheet Author
Compendium Curator
Ok, I had a chance to put this in a quick custom character sheet to test things out a bit... It does work: Here's the code for the above... HTML <fieldset class="repeating_stuff"> <input type="text" name="attr_info" /> <label>Type Info</label> </fieldset> <hr> <fieldset class="repeating_items"> <input type="text" name="attr_item" /> <label>Item</label> </fieldset> CSS: .repcontainer[data-groupname="repeating_stuff"] { display: flex; flex-flow: column; flex-direction: column-reverse; } In the above image, the top repeating section adds to the top, and the bottom repeating section adds to the bottom.
1642615819
vÍnce
Pro
Sheet Author
Thanks for this Finderski!
1642666036

Edited 1642666090
GiGs
Pro
Sheet Author
API Scripter
Nifty! I'm curious how this affects the macro shortcuts $1, $2, etc.
1642678840

Edited 1642678868
Finderski
Plus
Sheet Author
Compendium Curator
GiGs said: I'm curious how this affects the macro shortcuts $1, $2, etc. The order they are added is the way the $# works. So, $0 would be the item at the bottom. To confirm this, for the above image, I did the following in chat: Info 0: @{Iclu Nach|repeating_stuff_$0_info} and "Item 1" was output.
Perfect, thanks!!
1642702956
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
GiGs said: Nifty! I'm curious how this affects the macro shortcuts $1, $2, etc. This might be an argument against this method, as it could easily become misinterpreted by the user. But, until the display bugs with setSectionOrder()  get fixed, it's probably still the better option.
1642715042
GiGs
Pro
Sheet Author
API Scripter
Scott C. said: GiGs said: Nifty! I'm curious how this affects the macro shortcuts $1, $2, etc. This might be an argument against this method, as it could easily become misinterpreted by the user. But, until the display bugs with setSectionOrder()  get fixed, it's probably still the better option. Are you saying the CSS is the better option? What bugs are those with setSectionOrder?
1642715540
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
For something as straightforward as this, yes I think the css option is better currently. Setsectionorder has a weird bug where the display of the elements in the section doesn't get properly updated after the reorder and any input/textarea that is empty will display the values of the item that was there before the reorder. Furthermore, it can actually lead to data corruption because if anyone clicks in the erroneously displaying fields before the display gets fixed, that display error gets converted to real data. There's a few sheetworker driven ways to fix the display and closing/reopening the sheet resolves it as well.
1642716401
GiGs
Pro
Sheet Author
API Scripter
Finderski said: GiGs said: I'm curious how this affects the macro shortcuts $1, $2, etc. The order they are added is the way the $# works. So, $0 would be the item at the bottom. To confirm this, for the above image, I did the following in chat: Info 0: @{Iclu Nach|repeating_stuff_$0_info} and "Item 1" was output. Thanks, I thought that might be the case. Something to be wary of. Also Scott, thanks for that info.
1642721580
Andreas J.
Forum Champion
Sheet Author
Translator
<a href="https://wiki.roll20.net/RowIndex" rel="nofollow">https://wiki.roll20.net/RowIndex</a>