First off, thanks so much for such a cool contribution. The functionality is great and the api is very clean and flexible.
I'm having a strange behaviour and just can't seem to get a handle on..
I have a view that, in addition to the node data, has "edit node" links that I have successfully hooked into the modal api. So say I have a view with 5 nodes in the list. There are 5 edit node links.
If I click on an edit node link, the node form comes up nicely in a modal. Save the node, the modal closes. Perfect. The problem is if I go to open another node from the view -- they won't open in a modal, they open in a new page. If I refresh the view, the modals work again.
I've looked in the page code. When the view first loads up the "edit node"links look as follows:
<a class="vendor-modal-child vendor-modal-size[600,400] vendor-modal-processed" href="/vendors-admin/2645/edit">Edit</a>
When I save the node and the modal closes, the same link looks like this:
<a class="vendor-modal-child vendor-modal-size[600,400]" href="/vendors-admin/2645/edit">Edit</a>
When I refresh, it returns to the first state and the modal link works again. Seems to have something to do with that "vendor-modal-processed" class.
Any ideas?
Comments
Comment #1
jghyde commentedCan you copy your javascript code in here? Looks like jquery is resetting the class declarations.
Comment #2
mpaler commentedThanks for looking
Comment #3
jghyde commentedMaybe get more specific in the selector:
$('a.vendor-modal-child:not(a.vendor-modal-processed)').addClass('vendor-modal-processed').click(function() ...Comment #4
mpaler commentedIn my case, the view was being dynamically refreshed with data submitted by the modal form. As such I needed to put a Drupal.attachBehaviors(); function into the javascript so the newly loaded html would have the modal javascript attached to it.