I'm using a sub-theme of pixture_reloaded. The html structure of a block on my page (I'm also using collapsiblock module) is

<section class="block collapsiblock-processed" id="block-elog-elog-dtm-listing">  
      <h2 class="block-title collapsiblock"><a role="link" href="#">Ongoing Downtime Events</a></h2>
     <div class="ajaxblocks-wrapper-7" id="block-elog-elog_dtm_listing-ajax-content"></div>
</section>

Inside the ajaxblocksSetBlockContent function of the ajaxblocks.js file is the following code

var wrapper = $('#block-' + id + '-ajax-content');
  if (!wrapper) {
    return;
  }
  var context = wrapper.parent();
  Drupal.detachBehaviors(context);
  if (!context) {
    return;
  }
  $('#block-' + id).addClass('ajaxblocks-loaded');
  context.html(data['content']);

The context whose html is being replaced is my #block-elog-elog-dtm-listing section. When the html is replaced, I lose the "h2" title element inside of it. I have to make the following code change in ajaxblocks.js to make it work in this situation:

//context.html(data['content']);
wrapper.remove();           // Remove the ajaxblocks wrapper to get rid of "spinner" gif.
context.append(data['content']);  // Append fetched content so we can keep block title
CommentFileSizeAuthor
#2 ajaxblocks-title-is-lost-2215737-1.patch459 bytestlarrieu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tlarrieu’s picture

Issue summary: View changes
tlarrieu’s picture

Title: Title is lost when block is updated » Patch file
FileSize
459 bytes
helmo’s picture

Title: Patch file » Title is lost when block is updated
Status: Active » Needs review

updating status

helmo’s picture

Status: Needs review » Closed (duplicate)

Found this to be a duplicate of #1973786: Block loose its title after ajax loading which is already tested