I'm returning a view display for a preview that contains an edit link to the node being referenced. I'd like the edit link to popup a modal frame, so I've added the automodal class to the views output.

The attached patch is required to run Drupal.attachBehaviors on the results of the view output correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jpklein’s picture

+1 for getting this rolled into the next release; I just spent three hours hunting this down myself in order to get Lightbox2 to bind to preview images.

Building on what blakehall wrote, I'd suggest getting rid of the call to Drupal.attachBehaviors(this) altogether. In the scope of $.getJSON, 'this' refers to the JSON request object, which doesn't contain any of the returned data.

Additionally, I'd tweak the patch by passing the 'preview' DOM object without a jQuery wrapper to reduce overhead. See the attachment for my updates.

gnindl’s picture

Status: Needs review » Fixed

Tested & committed latest patch - great work, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.