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

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

Comments

Projects
None yet
9 participants
@slbug

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

This comment has been minimized.

Show comment Hide comment
@fat

fat Aug 14, 2012

Member

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!

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 Aug 14, 2012

@jeffcombs

This comment has been minimized.

Show comment Hide comment
@jeffcombs

jeffcombs Aug 29, 2012

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?

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

This comment has been minimized.

Show comment Hide comment
@slbug

slbug Aug 30, 2012

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

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

This comment has been minimized.

Show comment Hide comment
@jeffcombs

jeffcombs Aug 30, 2012

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

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

@slbug

This comment has been minimized.

Show comment Hide comment
@slbug

slbug Aug 30, 2012

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

slbug commented Aug 30, 2012

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

@ripperdoc

This comment has been minimized.

Show comment Hide comment
@ripperdoc

ripperdoc Sep 2, 2012

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: twitter#4392

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: twitter#4392

@xps

This comment has been minimized.

Show comment Hide comment
@xps

xps Sep 5, 2012

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

xps commented Sep 5, 2012

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

@ripperdoc

This comment has been minimized.

Show comment Hide comment
@ripperdoc

ripperdoc Sep 5, 2012

@xps there is a pull request to accept new options here twitter#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.

@xps there is a pull request to accept new options here twitter#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

This comment has been minimized.

Show comment Hide comment
@bes89

bes89 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

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

This comment has been minimized.

Show comment Hide comment
@slbug

slbug Sep 19, 2012

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

slbug commented Sep 19, 2012

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

@slbug

This comment has been minimized.

Show comment Hide comment
@slbug

slbug Sep 19, 2012

check my fork, branch 2.1-wip

slbug commented Sep 19, 2012

check my fork, branch 2.1-wip

@ciprogrammer

This comment has been minimized.

Show comment Hide comment
@ciprogrammer

ciprogrammer Dec 8, 2012

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

worked for me. Thanks

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

worked for me. Thanks

@danschumann

This comment has been minimized.

Show comment Hide comment
@danschumann

danschumann Jul 14, 2014

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

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

This comment has been minimized.

Show comment Hide comment
@cvrebert

cvrebert Jul 14, 2014

Member

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

Member

cvrebert commented Jul 14, 2014

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

@cvrebert

This comment has been minimized.

Show comment Hide comment
@cvrebert

cvrebert Jul 14, 2014

Member

Locking this issue due to its age.

Member

cvrebert commented Jul 14, 2014

Locking this issue due to its age.

@cvrebert cvrebert 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.