Closed (duplicate)
Project:
Views Datasource
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Sep 2012 at 04:12 UTC
Updated:
13 Sep 2014 at 16:32 UTC
Jump to comment: Most recent
Comments
Comment #1
arrubiu commentedSubscribe..
If I try to use a json output I obtain a "normal" drupal page with the json in the content.
Comment #2
markbrule commentedSubscribe.
Comment #3
markbrule commentedI went back and read the options more carefully. To get the output without the rest of the page markup, you need to uncheck the "Views API Module" option in the JSON output settings page. That is, when you have set the format to "JSON data document", in the settings panel after setting the "content-type" (to application/json or text/json) uncheck the "Views API Module" checkbox. This is checked by default.
Comment #4
arrubiu commentedOk perfect :)
Comment #5
SeanBannister commentedComment #6
KimmoT commentedAttachment views won't work without Views API mode. At least in my case my "main view" is not loaded, but the attachment view is shown and output stops.
Using
Views 7.x-3.7
Views JSON 7.x-1.x-dev
Comment #7
anthonylindsay commentedWhy would you want to use an attachment?
I'm not surprised that an attachment won't work. As far as I understand it, when you uncheck the Views API mode button Drupal ceases normal page processing, like when you call drupal_json_output(). A normal views attachment is a discrete thing from the view to which it is attached. I'd expect that a view that is formatted as json would behave no differently.
So I'd expect that you'd need to put each view on a discrete url and call them separately. If you absolutely need to combine two views into one json object you could create a custom module to implement hook_menu() to create a json endpoint for your output and a custom function to call both views separately and process and combine their output as you require. Then finally call drupal_output_json() to actually send your combined view down the wire.
If you have any control over what is consuming the data, then it would be simplest to deal with two separate calls directly on the page, I think.
Comment #8
KimmoT commentedBasically, I just would have wanted to keep things simple avoiding using hook_menu and all that, but I ended up solving it exactly like you suggested.
So I'm guessing it's safe to call this closed.
Comment #9
joecrespo commentedThe UI could use a tweak.
This label is confusing:
Changing the language will go a long way toward clarity.
Thanks for the module!
Comment #10
opdavies+1 for #9.
Comment #11
yannickooLet us fix that in #2337915: Views API mode should be unchecked by default.