I have created a page that is a list of nodes. I want each node to link to another page that is a list of nodes RELATED to the clicked node.
For instance, let's say I had a list of car company:
Ford
Chevy
Honda
Toyota
If I click on a link in this list (for instance Honda) I would get a list of models, for instance:
Civic
CRV
Accord
This list of models is linked from the car company list as an entity reference that is filtered by contextual filter in a view, like so:
http://www.cars.com/models/Ford
How do I pass an argument to pageshow like this?:
'models_by_company':{
'title':'Models',
'page_callback':'my_model_by_company_page',
'pageshow':'my_model_by_company_page_pageshow',
'pageshow_arguments':'company'
}
function my_model_by_company_page_pageshow(company) {
drupalgap.views_datasource.call({
'path':'models/company'
Comments
Comment #1
mastermindg commentedComment #2
tyler.frankenstein commentedTry this:
Comment #3
mastermindg commentedThanks for the quick response! I'm getting the following error:
menu_execute_active_handler(404/models_by_company/Ford) - TypeError: Cannot read property 'page_callback' of undefinedHere's my code:
Comment #4
tyler.frankenstein commentedHmmm, that code looks fine. Are you using the latest development snapshot of the mobile application development kit and the latest development snapshot of the Drupal module?
Also, how are you navigating to "models_by_company/Ford"?
What happens if you navigate to "models_by_company"? (with no argument)
Either way, try the latest snapshots and let me know how that goes.
Comment #5
mastermindg commentedI updated the module to the latest snapshot but I can't seem to figure out how to build the snapshot of the development kit. I tried a few times and everything seems to be OK but I'm not getting anything in Ripple. I'm trying with branch 7.x-1.x-alpha-issue-199 since this has the most recent commits.
Besides this I've tried with the latest snapshot of the module and the latest stable release and am still seeing the same issue. I'm curious as why the url is being mixed up, though :
404/models_by_company/FordComment #6
tyler.frankenstein commentedI would not recommend using the 7.x-1.x-alpha-issue-199 because it is very bleeding edge at the moment, and doesn't have much documentation for how to deploy it.
The latest recommended release of the app dev kit isn't recommended right now. Instead, use the 7.x-1.x-alpha snapshot (https://github.com/signalpoint/DrupalGap/archive/7.x-1.x-alpha.zip) and the 7.x-1.x-dev snapshot (http://ftp.drupal.org/files/projects/drupalgap-7.x-1.x-dev.zip).
Be sure to uninstall the DrupalGap module, re-install it, then flush all of your Drupal cache's.
Let me know how the 7.x-1.x-alpha snapshot goes, that should work.
Also for debugging, I find it helpful to place this line at the top of your settings.js file if it isn't already there:
window.localStorage().clear();Comment #7
mastermindg commentedLike 99% of the issues that I have...this one was due to 2 characters:
'path':'deals_per_store/' + company,should be
'path':'deals-per-store/' + company,Thanks so much for all the help. I look forward to an enriching experience with Drupalgap!
Comment #8
mastermindg commentedComment #9
anybodyHello tyler.frankenstein,
thanks a lot for your help. I was just searching for the same method and I could not find it in the "pages" or menu section of the DrupalGap Documentation.
Anyway I think it's essential and could help many people. Could you perhaps add such a snippet for dynamic paths there? That would be very nice.
Thank you so much for you unbelievable work in DrupalGap! It's great, you are a hero!
Comment #10
d16_dylan commentedI was wondering how to pass multiple arguments in this case, Say for a URL
'models_by_company/abc/efg'
I tried
but i get 404 error
Comment #11
tyler.frankenstein commented@d16_dylan, that's the correct syntax.
Comment #12
d16_dylan commented@tyler
Using the above menu i get 404 not found error on the URL: models_by_company/14/modelspage,
My page function is
both of the 'console.log' statements don't print, so i'm assuming this page function is not called at all
Everything seems to work fine with single argument
Comment #13
tyler.frankenstein commentedHmmm, looks like you may have found a bug there.
You can try using a single argument and a query string:
l('Foo', 'models_by_company/14?page_id=modelspage');Then you can extract the query string value:
var page_id = _GET('page_id');That's probably the quickest way around it, otherwise please file a new bug report on GitHub if you have time.