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

modal from 2.1-wip load remote content only once #4197

Closed
slbug opened this issue Jul 27, 2012 · 15 comments
Closed

modal from 2.1-wip load remote content only once #4197

slbug opened this issue Jul 27, 2012 · 15 comments
Labels

Comments

@slbug
Copy link

slbug commented Jul 27, 2012

After closing and opening same modal it will not request content. Adding $.ajaxSetup({ cache: false });

not helped. Is it but or there is some trick to avoid it?

@fat
Copy link
Member

fat commented Aug 14, 2012

Hey @slbug,

Thanks for opening this issue! Unfortunately, it looks like it fails to pass the criteria necessary for submitting to bootstrap. The following things are currently failing:

  • should include a jsfiddle/jsbin illustrating the problem if tagged with js but not a feature

For a full list of issue filing guidelines, please refer to the bootstrap issue filing guidelines.

thanks!

@fat fat closed this as completed Aug 14, 2012
@jeffcombs
Copy link

I don't see that the issue is resolved. In the example above I see the same problem. I tried the code change in Pull Request #4224 and see no difference in behavior. Anyone have this working?

@slbug
Copy link
Author

slbug commented Aug 30, 2012

@jcombsctx if you applied patch from #4224 then don't forget to add cache: false option in modal setup

@jeffcombs
Copy link

I've tried that to no avail. I am using the data API

@slbug
Copy link
Author

slbug commented Aug 30, 2012

data-toggle='modal' data-target='#modal_dialog' data-cache='false' works for me

@ripperdoc
Copy link

I would not only want the modal to reload each time, but also accept new options. For example, I have a table where each row has a button to show the modal. It would be wasteful to create one modal div per row, so I'd prefer re-using one, but re-load the content. Currently, when invoking the modal, it will not accept new options the second time it's created, which means that even if I reload the contents, it has not changed the remote URL option. Will see if I can fix a pull request for this but I'm a newbie on JS unit testing so let's see.
UPDATE: See pull request fixing this here: #4392

@xps
Copy link

xps commented Sep 5, 2012

Doesn't help me either as I'm looking to load a different URL...

@ripperdoc
Copy link

@xps there is a pull request to accept new options here #4392
So when it can accept new options, you just need to add an event listener to the show event on the modal, and reload the body with one ajax request.

@bes89
Copy link

bes89 commented Sep 19, 2012

@slbug which version you are using? data-cache='false' doesnt work

Edit:

Found a workaround:
$('body').on('hidden', '.modal', function () {
$(this).removeData('modal');
});

More info: http://stackoverflow.com/a/12287169/650606

@slbug
Copy link
Author

slbug commented Sep 19, 2012

not sure, some revision from 2.1-wip just before ~ 2 weeks before release of 2.1

@slbug
Copy link
Author

slbug commented Sep 19, 2012

check my fork, branch 2.1-wip

@ciprogrammer
Copy link

$('body').on('hidden', '.modal', function () {
$(this).removeData('modal');
});

worked for me. Thanks

@danschumann
Copy link

Since the modal is initialized with options, why not allow a cache: false option? It seems more proactive than setting a listener-- shorter too.

@cvrebert
Copy link
Collaborator

@danschumann The feature was rejected in #13788. Subsequently, we opted to deprecate remote modals altogether in #14034.

@cvrebert
Copy link
Collaborator

Locking this issue due to its age.

@twbs twbs locked and limited conversation to collaborators Jul 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants