Using drupal 7, I have a view that created an aggregated table like this:

Animals 44

Plants 25

I want that when user clicks on 'Plants', on the same view, without refreshing, the list of the 25 plants (coming from another view) comes out, appending the HTML to the Plants div.

I think that views_embed_view might be the solution. I am on the right track? how do I specify on which DIV the generated view should be appended to?



You are on the wrong path.

Install the Views Megarow Module. Then create another view that will list the respective Animals and Plants together. Set the path as well, in this example I will assume a path of


Note the argument.

Then add a contextual filter of 'Content: Type'. When the filter value is not in the URL, display content of no results found. Verify that it works by typing the content type (animal or plant, ie the machine name of your content) in the preview contextual filters section at the bottom. It should only show the nodes for the specific content type that you type in.

Back to the original view, select the Format as Megarow table. Add a field 'content type', and set its display to hidden. Move this field so that it is the first field in the list. Then add a field Megarow links. In the megarow settings, there is a section 'Links'. Add this:


This will now create a link which when you click on it loads your content using AJAX. You might have to adjust your view slightly as you are using aggregation.

Good luck!

I have just created this view with aggregation active and views megarow does not play nice with it. But all is not lost. Install Views Field View also. Then create a new view wherein you embed a field of a view. This field must then use the view of your aggregation and append as an argument that is passes the node type again. Then in you original aggregated view you have a contextual filter by type and you do your aggregation as normal. This aggregated view will then return your aggregation result per content type to the new view, and in the new view you add your megarow field.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.