Hi all:
I could use some advice re the best approach.

    The background

I'm trying to create a Google Docs sort of interface for a view.
Work to date is at d7.ophed.com
I want a filters block on the left, a table in the middle and a preview block on the right.
I started with a VBO view.
I've created a block containing a form with some filters.
That block uses ajax processing to set some view filters and then display the view via view->preview
For now the preview block is filled (with another view) via an AJAX call when the user clicks on the title in the VBO view.
There's a popup menu in the rows that will allow the user to perform actions on a node. It pops up when you hover over it.
I didn't use views exposed filters capability because I wanted to do some interesting things with the filters.
For instance I want radio button formatting and a text input that searches title and body simultaneously.

    Here's the problem

Whenever I change the view via it's own interface (changing the page for instance) it loses all of it's filter settings.
Whenever I change the view via my filters block it loses it's internal settings (paging, sorting, etc).

How do I get them to talk to each other?
Are form states persistent between calls to Drupal? If so, how do I get at them?
Is the state of a view somehow persistent between calls to Drupal? If so, how do I get at it?
Is there another approach to take?

Thanks

Comments

jwaxman’s picture

Still trying to figure this out.
I figured that looking at how Views does it with its own exposed filter blocks should help.
The exposed filter form from Views submits the name of the view, the page and the arguments in it's Ajax call.
I thought that these must be in the hidden values in the exposed filter form block. I don't see them there though when I inspect the HTML in firebug.
Likewise, when clicked, the pager links submit the filters applied name of the view, the page and the arguments in it's Ajax call. I can't see where in the HTML it's getting these.
So far this is looking like magic to me.
I've concluded that I have a basic misunderstanding.
Can anyone point me in the correct direction?

jwaxman’s picture

Got it working now.
I experimented with the built in exposed filter block system and experienced glitches. The AJAX call consistently confused the two views on the page. (the table view that is was supposed to talk to and the single node preview view that it wasn't)

I experimented with setting filters by setting $myview->display['default']->display_options['filters'] directly and then calling $myview->preview. (Found this is on the web somewhere) This worked but the page links built in to the table view did not recognize the filters.

Finally achieved success by
1) exposing the filters
2)

    not

placing the exposed filter block on the page
3) setting the filters with $myview->set_exposed_input
4) getting the output with $myview->preview

I looked for a way to implement this as a plugin or a handler but failed to find anything I could understand.

The Delete link in the popup action menus refreshes the view by resubmitting the form after its performed its delete action.
The action menu should probably be implemented as a new field type instead of a PHP field.

Next steps:
implement sorting as a pair of drop down select box in the header
implement actions that use pop up dialog boxes to perform their tasks (tag node with ...)
enable switch between a summary and detailed view in the table

I'm still back and forth on the question of whether nodes should be categorized by taxonomy only or by node references to & from a 'category' node type. The difference between taxonomy and nodes appear increasingly blurred in D7. It'd be nice to be able to create/delete/rename etc a category just like a node (the way folders in a file system work) and I don't think views can simultaneously present taxonomy terms and nodes in the same view.

I'm probably reinventing the wheel but I haven't found easy answers by searching.

dawehner’s picture

implement sorting as a pair of drop down select box in the header

that's easy you can expose sorts as well.

I'm still back and forth on the question of whether nodes should be categorized by taxonomy only or by node references to & from a 'category' node type. The difference between taxonomy and nodes appear increasingly blurred in D7. It'd be nice to be able to create/delete/rename etc a category just like a node (the way folders in a file system work) and I don't think views can simultaneously present taxonomy terms and nodes in the same view.

That's sure a different question. In general views will never be able to present terms and nodes without any kind of workaround in the same view, because that's basically incredible hard on the sql layer. You always have a SELECT * FROM {TABLE} and TABLE basically describes the result what you get. Maybe one time there will be an {entity} table but this can be doubted

jwaxman’s picture

Thanks. I started looking for a second method in the views object to set the sort order.
It turns out that it's done in the same set_exposed_input method by adding 'sort' and 'order' elements to the input array. Who knew?

Thanks for saving me the time I'd have spent trying to create a view of different types of entities.

Now to figure out the difference between plugins and handlers and their relationship to hooks in views.

kars-t’s picture

Status: Active » Fixed

Hi

I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.

Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.