Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2010 at 15:23 UTC
Updated:
11 Oct 2011 at 20:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerHow do you embed the view?
Perhaps it would be also cool if you export your view so it's reproducable
Comment #2
gnindl commentedOk, the process is like this:
1. A JSON request is processed via JavaScript, i. e.
$.getJSON(settings['dialog'], function(data, textStatus) ...2. Then a custom menu call back is accessed
3. The view is rendered like
3.a
$output = call_user_func_array('views_embed_view', $args);or3.b
$output = views_embed_view($view->name, $display_id);4. The $output is returned as a JSON string:
$ret_msg['data'] = $output; drupal_json($ret_msg);5. Finally on the client side the rendered html (data) is inserted in the DOM and processed further with jQuery UI
That's about it. For more details please have a look at this release especially at the files
- js/explorer.actions.js from line 38 - 56
- includes/nodereference_explorer.menu.inc, function nodereference_explorer_dialog()
- includes/nodereference_explorer.views.class.inc, function get_display()
Probably the View is generating this problem (see attachment). Nevertheless I am looking for a View which is compatible with the versions 2 & 3.
Comment #3
gnindl commentedI detected the source of the problem. It's the way how exposed forms are included programmatically. Here's a working code from Views 2:
However Views 3 requires a form plugin object in the $form_state array, i. e.
$form_state['exposed_form_plugin'];So my question is: Is the client responsible for creating this object or is rendering of forms done in a different way?
For my purposes it would be convenient to keep this code, as I don't see any advantage of creating a plugin object manually.
Comment #4
merlinofchaos commentedNo, it should use the plugin that's been assigned in the View, so you should not need to create a plugin unless you need to provide some functionality.
Comment #5
gnindl commentedThanks merlinofchaos, the solution is quite easy now. I just have to get the exposed form plugin from the view object. This code works for me in Views 2 & 3:
Comment #7
alanpeart commentedIt took me a long, long time to track down this information - thank you!
Comment #8
mathieu commentedJust adding a quick note here, for people stumbling on this issue. If all you want is to have the filters displayed in a block, you can use the "Exposed form in block" option that you'll find in your views display settings.
Comment #9
Anonymous (not verified) commentedI'm trying to use this code to embed an exposed filter from a view with a dynamic URL.
Basically I have 'directories' of nodes that get sorted by 'city'.
The view works great using the city/%/directory url.
However, I want to embed the exposed filter on the panel page '/city/orlando' (for example) and have the view take the city from the URL and use the same on in it's own URL. (/city/orlando/directory?my_filter=search)
Right now, it either applies the argument to the panel URL or '/city/all/directory'.
Any help would be appreciated!
Thanks,
EDIT: Sorry, I'm using 7.8 and the Views 3.
Drew