Getting Bootstrap Modals working with IDOM #526
-
I was thinking that I probably need to run a JS script on click to modify the modal. For example, Is it possible to do this without writing a custom JavaScript component? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 12 replies
-
@rmorshea Let me know if this is possible. Currently I'm stuck on getting modal popups to occur. From my side the simplest solution seems to just be running JS on-demand. The only alternative I know of is porting React Bootstrap to IDOM. |
Beta Was this translation helpful? Give feedback.
-
Without custom components you're not going to be able to respond to even handlers with a call to some javascript code. The only thing I can think of to help this (and I'm not sure it would allow you to do what you need) would be to create a idom.html.button("click me", script="node => { node.onclick = () => console.log('clicked!'); }") |
Beta Was this translation helpful? Give feedback.
-
Also, porting import idom
bootstrap = idom.web.module_from_template("react", "react-bootstrap")
Button = idom.web.export(bootstrap, "Button")
@idom.component
def App():
return idom.html.div(
idom.html.link(
dict(
rel="stylesheet",
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3",
crossorigin="anonymous",
)
),
Button({"variant": "primary"}, "Primary"),
)
idom.run(App) |
Beta Was this translation helpful? Give feedback.
-
I'm having similar issues with Bootstrap NavbarToggle bootstrap = idom.web.module_from_template(
"react", "react-bootstrap", resolve_exports=True
)
toggler = idom.web.export(bootstrap, "NavbarToggle") |
Beta Was this translation helpful? Give feedback.
-
I've determined a temporary workaround for bootstrap modals. The For now, I'll require developers to manually construct the modal contents, rather than using things like |
Beta Was this translation helpful? Give feedback.
Without custom components you're not going to be able to respond to even handlers with a call to some javascript code. The only thing I can think of to help this (and I'm not sure it would allow you to do what you need) would be to create a
script
parameter which gets evaled on the initial render: