Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

AjaxDeleteView doesn't do anything #7

Open
Alex-CodeLab opened this issue Mar 18, 2015 · 5 comments
Open

AjaxDeleteView doesn't do anything #7

Alex-CodeLab opened this issue Mar 18, 2015 · 5 comments

Comments

@Alex-CodeLab
Copy link

my normal delete views are working, but when I add to the link
class="fm-delete" data-fm-head="Delete" data-fm-callback="reload"
and set my view to AjaxDeleteView , nothing happens.
I click the delete link, I see an empty modal window, but there isn't an ajax call to load the delete_confirm template. no error messages.

Other views are working fine (like AjaxUpdateView)

@FZambia
Copy link
Collaborator

FZambia commented Mar 19, 2015

Hello, could you look at browser network console and show request and response headers and status code?

@Alex-CodeLab
Copy link
Author

I think I found something: I had removed the "modal-buttons" in your template, and put some buttons in my own templates. This works fine for fm-update , since it loads the template/form in the modal window.
I tried using your "modal-buttons" again, they show up in the modal window (btw, no request being made for this) and I can click to delete.
When using fm-delete, there is no request to load a template/form. Usually there is a template_delete_confirmation.html being loaded, but not when using fm-delete.

@Alex-CodeLab
Copy link
Author

this did the trick:
in fm.js,
function show_delete_modal(element) {
...
load_content(options); // add this

@FZambia
Copy link
Collaborator

FZambia commented Mar 19, 2015

this is because of this https://github.com/FZambia/django-fm/blob/master/fm/static/fm/js/fm.js#L133

When you delete modal_buttons nothing triggers DELETE request, maybe using your own modal_buttons_selector can help?

@Alex-CodeLab
Copy link
Author

No, that is not what I mean :)
it is not about submitting, but creating the modal/form.

As you can see in your demo, clicking Update creates a GET request to load the form content.
Clicking the Delete button does not trigger a GET to create the delete form, but this still works when using your template because it has buttons build in the template.
I use my own form templates so I can do some extra styling (and buttons), but it was never rendered in case of 'Delete'.

So, it is not actually a bug, just a situation that comes up when people want to style their own form.
I'll try to come up with a fork that allows to style the forms a bit .
(close this issue if you want)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants