Hi.
I was looking for a way to refresh a views block on my page depending on a Flag being set or unset.
I figure, the easiest way is to call a custom JS function that mimics what quicktabs does to refresh (load) a new Views tab.

When I looked into the code for the tabs, I was a bit confused with what I found:

The tabs seem to be links with destination attribute as:
?quicktabs_1=0
?quicktabs_1=1

and so on...

But I also noticed that there's an Ajax call to:
/views/ajax?view_name=&view_display_id=block_1&view_args=

This call, by itself, returns the refreshed view that needs to be displayed.
Is there some way that I can call some JS function which in turn makes this Ajax call and displays the data in the quicktab block?

Comments

Pasqualle’s picture

Priority: Critical » Normal

So you want a refresh tabpage functionality, that could be a good feature..

check the quicktabsClick function in quictabs.js
I think you just need to modify it a little for the refresh. When the tabpage exists you have to remove it and reconstruct.

this part should be changed:

  // Show the active tabpage.
  if (tab.tabpage.hasClass('quicktabs_tabpage')) {
    tab.tabpage.show();
  }
  else {

how does this function works:
the tabpage link contains all the info about the tabpage content
it looks like this:

<a id="view--qtid--tabid--myview--mydisplay--view_args" class="qt_tab" href="/node/42#quicktabs-qtid">Tab title</a>

The id is parsed with Drupal.quicktabs.tab() function, then the tabpage content is displayed with an ajax callback.

Please note that the code could be changed in the future, because storing info about the tab content inside the link has limitations.

Pasqualle’s picture

the code was changes in rc3, but the solution is still the same..
you need to destroy (remove) the old tabpage and recreate it with a simple .trigger('click') on the tab link..

If you have a working solution to refresh a tabpage please share the code, it could become part of the QT module.
similar issue: #420196: Ability to refresh tab when ajax enabled

netw3rker’s picture

Issue summary: View changes
Status: Active » Closed (fixed)