I'm fairly new to Drupal and Drupalgap.
My Drupal site has a view/content called "donations".
In admin/structure/views, there are two PATHs: /current-donations and /available-donations. And of course, this URL works fine: http://127.0.0.1:8083/current-donations
Now I'd like to render this view in drupalgap using a views render array.
My first attempt looked like:
function mobile_donor_donations_page() {
try {
console.log('mobile_donor_donations_list_page()-e');
var content = {};
content['avail_donations_list'] = {
theme: 'view',
format: 'ul',
path: '/available-donations', /* the path to the view in Drupal */
row_callback: 'mobile_donor_donations_list_row',
empty_callback: 'mobile_donor_donations_list_empty',
attributes: {
id: 'avail_donations_list_view'
}
};
return content;
}
catch (error) { console.log(':ER:mobile_donor_donations_page: ' + error); };
}
The above function gets called fine -- on my console (chrome, Ripple) I see
GET: http://127.0.0.1:8083/?q=/available-donations&page=0
200 - OK
views_embed_view - success - TypeError: Cannot read property 'count' of undefined
Looking at the views_embed_view() code below, it is throwing an exception because results.view is undefined:
// Render the view if there are some results, or if there are no results and an
// empty_callback has been specified. Otherwise remove the empty div container for
// the view from the DOM.
if (results.view.count != 0 || results.view.count == 0 && options.empty_callback) {
I tried http://127.0.0.1:8083/?q=/available-donations&page=0 from my browser, it returns html, not JSON.
To force JSON returned, I tried
path: 'drupalgap/node.json¶meters[type]=donation', /* the path to the view in Drupal */
This PATH does indeed return my content as JSON, however the error remains, since the JSON doesn't contain a "view" element.
GET: http://127.0.0.1:8083/?q=drupalgap/node.json¶meters[type]=donation&page=0
200 - OK
views_embed_view - success - TypeError: Cannot read property 'count' of undefined
What PATH do I need to supply, or do I need to change structure of my content in Drupal to get the view to render?
Thanks!
JSON Data Document
display in your View, then give it a page path? That is thepath
that you use when building the Views Render Array.