How can a view in DrupalGap, which is used by a custom module, NOT be cached but instead be called each and every time?

drupal.stackexchange https://drupal.stackexchange.com/questions/236799

  •  30-12-2020
  •  | 
  •  

Question

I am using a Local Task Menu as demonstrated in the docs to present one more tab named members next to View and Edit. This tab is showed only to group nodes and i have connected a custom view inside Drupal which fetches the members of this group. Works good. Fetches, displays and links the members in the appropriate page.
But the problem is that this view is called only the first time. In other words, if a user subscribes or unsubscribes from this group after the first call, then this change won't be updated and showed.
In Views Caching:None and Block caching:Do not cache but i think this is a matter of drupalgap menu cache.
Is there a way i can make this specific view not to be cached but instead be called every time the menu tab is clicked?

Was it helpful?

Solution

DrupalGap 7 is a multi-page application, which means as you navigate around, pages that you previously visited remain in the DOM. Then when you navigate back to that page, it is already in the DOM, so it isn't rebuilt.

All you need to do is add the reloadPage option to your link and that'll force the page to be reloaded upon navigation: http://docs.drupalgap.org/7/Pages/Reloading_Pages

/**
 * Implements hook_menu().
 */
function my_module_menu() {
  var items = {};
  items['foo'] = {
    title: 'Foo',
    path: 'foo-bar',
    options: {
      reloadPage: true
    }
  };
  return items;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top