What I’m trying to do:
I am using Anvil to create a report generator using PDFRenderer, etc. What I’d like to do is use a different form for each page of the report, then in code I can include/exclude pages depending on reporting requirements.
What I’ve tried and what’s not working:
I’ve tried using a ‘base’ form with a column panel, and then in code I .add_component depending on reporting requirements. For some reason, the component forms (panel1, panel2, panel3) are not rendering.
Code Sample:
from ._anvil_designer import main_formTemplate
from anvil import *
from ..panel1 import panel1
from ..panel2 import panel2
from ..panel3 import panel3
class main_form(main_formTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
def form_show(self, **properties):
self.main_cp.add_component(panel1())
self.main_cp.add_component(panel2())
self.main_cp.add_component(panel3())
Clone link:
https://anvil.works/build#clone:X4LE4AJ56G4AB6VW=A44MRCPK2FZY4ENXTGKKYPAP