What I’m trying to do:
I am embedding a google looker page on an iframe which sits below a button to “go back”. What I’ve tried and what’s not working:
I’ve inserted the element on the page using appendTo. The problem is the iframe keeps shrinking vertically and not occupying the full height of the page. I’ve tried applying styles to it with height:100%, but it looks like its parents still don’t have full height, so it doesn’t want to enlarge further than that. The parents are a div created by anvil, “appGoesHere” and “anvil-root-container”. What is the correct way to make that component fillt he remaining height? Is there no cleaner way than applying styles to each native and automatically creative div untill they all have 100% height? Code Sample:
# Create an iframe element and set the src
url = anvil.server.call('get_analytics_looker_url')
iframe = jQuery("<iframe class='anvil-role-looker-iframe flex-column-fill'>").attr("src", url)
iframe.appendTo(get_dom_node(self))
from ._anvil_designer import ForumiComponentTemplate
from anvil import *
import anvil.server
class ForumiComponent(ForumiComponentTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
def form_show(self, **event_args):
"""This method is called when the HTML panel is shown on the screen"""
self.call_js('setIframeSrc', 'some_url')
For my specific case I ended up using the “position: fixed” option, making it occupy full width and calculate appropriate height with calc, which worked for my case.