Giter Site home page Giter Site logo

Comments (6)

GammaGames avatar GammaGames commented on June 16, 2024 2

You're still recreating the modal, you have to change the setting:

$("#janela_mensagem").modal("setting", "closable", true);

https://jsfiddle.net/67a9kyj8/

from fomantic-ui.

batata004 avatar batata004 commented on June 16, 2024 2

Now I understood what you said! I was being stupid, I was not understanding how the logic worked! Now I do: if I need to change settings on an already opened modal, I need to use setting. Thank you so much for your patience with me !

from fomantic-ui.

lubber-de avatar lubber-de commented on June 16, 2024 1

If you call modal(), given an object as first parameter, on the same element, you are always recreating the modal. It gets even worse when the modal is already in progress (shown). That's the reason for the console error, because it expects internal variables which are created once the modal is shown. But as you are recreating the modal while it is shown, the internal variables get reset to undefined, causing the console error.
That said, It's not a bug.

So, if you need to recreate the modal, you can do so as many times as you want, but make sure the modal is hidden/closed.
If you only need to change some internal setting at runtime, use the setting behavior (this works also when the modal is in progress/shown)

from fomantic-ui.

lubber-de avatar lubber-de commented on June 16, 2024 1

@batata004 Here you are :)
https://jsfiddle.net/lubber/gv6sudry/

You can change onHide while the modal is shown, but only via the setting behavior (which i explained in the other thread)

from fomantic-ui.

batata004 avatar batata004 commented on June 16, 2024

In some cases, I really want to recreate the modal because I want all the other settings reverted to default (for example, I may have set onHide event and now I want to set closable to true at the same time that all the other events/settings get reverted to the default).

Yet, this is still a bug, right? Because I call modal twice, but at the second time some settings (like closable) are not setted correctly. Or is it prohibited to call modal twice on the same element?

from fomantic-ui.

batata004 avatar batata004 commented on June 16, 2024

@lubber-de @GammaGames So here is exactly my problem: I already opened a modal (it's already showing to the user). Now I need to change the onHide event. As you said in another thread, I cant change onHide after the modal is already showed and I also cant change onHide using setting feature. So how I change the onHide after I already opened the modal?

In my specific case, I showed the modal to the user and after the user interact with it (filling a form) I want the onHide event to be different depending on the answers the user provided in the form inside the modal.

So how do I change the onHide event after the modal is already displayed? I was trying to make a hack with closable but it didnt work, so I am back to the square 0.

from fomantic-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.