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

Dynamic tabs with repeating section : bad idea ?

1521287124

Edited 1521315701
Kaias C.
Sheet Author
Hello ! Here is my concern : player can have a lot of magic's schools in my game and i want to allow them to add tabs with school name and each tabs will display a set of spells. I've managed to create and manage dynamics tabs to filter the spell list, but it's heavy on sheet worker. Here is my more or less advanced theory and i want to gather opinion before goind further. 1- We add a css tab trick inside a repeating section but without radio (cause the radio name will be different in fieldset) (player can edit circleName inside a modal with an input to update tab's span) <fieldset class="repeating_magicsCircle"> <input type="checkbox" name="attr_magicCircleSelected" value="1" /><span name="attr_MagieCircle"> </span> </fieldset> 2- We add our magic spells section with 2 hidden fields : attr_MagieCircle (store the circle name) + attr_MagieCircleSelected <fieldset class="repeating_magics"> <input type="hidden" name="attr_MagieCircle" value="new" /> <input type="checkbox" name="attr_MagieCircleSelected" value=1> <div class="filter"> <!--- magic spell ---> </div> </fieldset> 3- Without radio, we need to check / uncheck tabs manually (sheet workers) onchange > repeating_magicsCircle:attr_magicCircleSelected parse > repeating_magicsCircle set (ALL) > repeating_magicsCircle:attr_magicCircleSelected = 0 ( + silent to avoid loop ) set (checked) > attr_magicCircleSelected = 1 ( + silent to avoid loop ) 4- Without names or classes we can't use CSS trick to display / hide our spells, we need to use sheet workers again to check all spells with the same school as the tab onchange > repeating_magicsCircle:attr_magicCircleSelected parse > repeating_magics if > repeating_magics:attr_MagieCircle === repeating_magicsCircle:attr_MagieCircle set > repeating_magics:attr_MagieCircleSelected = 1 5- now, all the matching spells are checked and we can use CSS to display input:checked + div > display: block
I've spent my day on it but it's done : <a href="https://app.roll20.net/join/3097144/G1r1Sw" rel="nofollow">https://app.roll20.net/join/3097144/G1r1Sw</a> (it's in french sorry) 1- go to "Magie" tab 2- add / edit / remove a school (Ecole) on the left side 3- select a spell level (it's a double filter !) 4- add a spell &gt; the current school and level are stored inside the spell. To change a spell level or school : 1- check "Reassigner" 2- select the new school ou level (when Reassigner is checked there is no filter) 3- change something inside the spell (whenever a spell update is triggered, i update school and level) I would have preferred two selects (one with 15 levels and on with all the school) but i can't figure how to manage repeating_school inside a select without DOM Y_Y