DrupalGap icon indicating copy to clipboard operation
DrupalGap copied to clipboard

Views Render Array + Custom Form + Passed arguments

Open gs9999 opened this issue 8 years ago • 1 comments

Hello again,

I built a custom form that validates and submits various selectors by passing the form_state.values.xxx by using drupgalgap_goto('searchmalesearch/' + value + '/' + value2); and adding the values to the view name, like this: The view name then looks like 'view_name/' +us+ '/' + 'ca' . I use this in a views render array straight from the docs.

function search_for_members_male_view_menu() {
  var items = {};
  items['searchmalesearch/%/%'] = {
    title: 'Search All',
    page_callback: 'search_for_members_male_view_page',
    page_arguments: [1,2],
  };
  return items;
}

function search_for_members_male_view_page (variable1, variable2) {

view_path = 'search-for-males-ma/' + variable1 + '/' + variable2;
var content = {}
    content['search_for_members_male_view_content'] = {
      
      pager_pos: 'bottom',    
      theme: 'view',
      exposed_filters: false,
      format: 'ul',
      path: view_path, /* the path to the view in Drupal */
      row_callback: 'search_for_members_male_view_list_row',
      empty_callback: 'search_for_members_male_view_list_empty',
       attributes: {
             id: 'search_for_members_male_view_content_list',
	         },
    };
 return content;
}

The problem is 3 things. 1. the exposed filters ARE showing even though I am using the exposed_filters: false setting. View infinite auto scroll won't show utilizing the settings for 'searchmalesearch/%' as the page.

and most importantly, upon loading the app, the view will show up when loaded from the form, but then all subsequent loads will show a blank page. I believe that views cache is set to false in settings.js...

Any insight?

Thanks,

GS

gs9999 avatar Feb 01 '17 06:02 gs9999

@gs9999

the exposed filters ARE showing even though I am using the exposed_filters: false setting.

Grab the latest bin/drupalgap.min.js file, I may not have included this feature in the recommended release yet.

View infinite auto scroll won't show utilizing the settings for 'searchmalesearch/%' as the page.

Are you using searchmalesearch/%/% with two % in the infinite scroll config? Like so:

drupalgap.settings.views_infinite_scroll = {

  // Specify which pages in the app to activate infinite scroll on.
  pages: {

    'searchmalesearch/%/%': {
      pages_allowed: 2
    },

  }

};

If that doesn't work, please open a separate issue in the VIS module: https://github.com/signalpoint/views_infinite_scroll

upon loading the app, the view will show up when loaded from the form, but then all subsequent loads will show a blank page. I believe that views cache is set to false in settings.js...

This probably has to do with duplicate id values in the DOM. Try appending the contextual filters to your Views Render Array id so that it is unique for each page:

attributes: {
 id: 'search_for_members_male_view_content_list_' + variable1 + '_' + variable2
},

signalpoint avatar Feb 01 '17 14:02 signalpoint