Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - Updating Modal via modal.objects results in the display of the updated objects in place of modal #7669

Open
SultanOrazbayev opened this issue Jan 27, 2025 · 0 comments

Comments

@SultanOrazbayev
Copy link
Contributor

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info
panel==1.6.0

Description of expected behavior and the observed behavior

Running the code below will show the modal window as expected. However, if the lines inside __update_modal are uncommented, then clicking the button inserts the modal contents into the main page and does not show the modal correctly. This bug prevents dynamic update of the modal contents.

Complete, minimal, self-contained example code that reproduces the issue

import param
from panel import Column, Modal, extension, template, widgets

extension("modal")


class TestApp(param.Parameterized):
    text = param.String(default="Hello, World!")
    slider = param.Number(default=0.0)

    def __init__(self, **params):
        super().__init__(**params)
        self.modal = Modal("TEST", widgets.TextInput(name="Text:", value=self.text), name="Basic FloatPanel", margin=20)
        self.toggle_button = widgets.Button(name="Toggle modal", button_type="primary")
        self.toggle_button.on_click(lambda event: self.__update_modal())

    def __update_modal(self):
        # self.modal.objects = [
        #     widgets.FloatSlider(name="Slider", value=self.slider),
        # ]
        self.modal.show()

    def __panel__(self):
        return Column(
            self.modal,
            self.toggle_button,
        )


test = TestApp()
app = template.VanillaTemplate(title="Basic Modal", main=[test])
app.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant