I have a specific case where I embed a view in the tpl of a field using php

   $view = views_get_view('view_name');
   $args = array();
   print $view->execute_display('default', $args);
  

In case the parent view is using the accordion style, javascript will affect the embedded view as well, which is not the preferred outcome. The only solution I can think of is changing the class names of the embedded view so javascript does not affect the embedded view.

Comments

toemaz’s picture

Title: Emedd » Nested view is getting affected by accordion javascript

Updating the title. I was to fast.

manuel garcia’s picture

Status: Active » Postponed (maintainer needs more info)

Not sure I'm understanding what the problem is...

So you are embeding a view inside a field tpl, that is being rendered by another view that has the accordion style applied?
Or is the view being embeded in a field tpl that is being used on a normal node displayed normaly?

If you are executing a display that has the accordion style, then the accordion should be applied to it. What view+display has the accordion style applied?

Cannot replicate this in order to help you out... please provide all info so I can recreate this situation localy.

toemaz’s picture

Status: Postponed (maintainer needs more info) » Active

I have a field tpl file where I embed another view which does not implement an accordion style, but just a simple default one with fields. So: one accordion view with a couple of fields, where one of the fields is themed with an embedded view of a unordered list view of fields.

I hope this is enough info, if not, let me know.

manuel garcia’s picture

I'm stil not seeing this but well, there was another issue that might be related, #479758: Auto cycle - start link appears at other views, and that made me identify a bug in the way we were selecting things in the JS.

I've commited the change to fix that issue, http://drupal.org/cvs?commit=221368 check when the new dev package comes out if this helps out in your case.

Otherwise, it'd be of great help if you take a screenshot of how the view is getting affected by the js in the browser...

toemaz’s picture

Thanks for the follow up Manuel. I removed the nested view some time ago, so I avoided to solve this issue. You may close/postpose/... this issue if you wish. I don't have the time to look into this any further.

Thanks for your support and for this nice module.

manuel garcia’s picture

Status: Active » Closed (fixed)

Fair enough

shady_gun’s picture

So any other progress on this??

Well my scenario is i have created a content type, and i am calling that content type in the view(views accordian style ) ..

well it works till here ... now if i try to embed another view in that content type .. the accordian replicates and all the views that are embedded is taken as another accordian ...

How to solve this..

regards

dkingofpa’s picture

Title: Nested view is getting affected by accordion javascript » Nested view is getting affected by accordion javascript and css
Version: 6.x-1.2-beta3 » 6.x-1.3
Category: support » bug
Status: Closed (fixed) » Active
StatusFileSize
new33.8 KB

I'm getting this exact same error. I have an accordion. Inside each row of the accordion, I have a field template file where I embed a block view (no accordion). The parent accordion javascript and styles have cascaded down into the nested views. Take a look at my attached screenshot. The nested views should just be a list of links. Unfortunately, they've been turned into an accordion as well.

Any help would be greatly appreciated.

dkingofpa’s picture

Status: Active » Needs review
StatusFileSize
new32.09 KB
new753 bytes

I made a simple change to fix this for me (see attached image). Basically, I just made sure the jquery selection wasn't overly general that it selected all headerSelector descendants of idSelector. Now it only selects the first level of headerSelectors. This patch was rolled from 6.x-1.3 since that's what I'm running in production.

manuel garcia’s picture

Thanks for the patch dkingofpa, I'll take a deeper look when I return from CPH

manuel garcia’s picture

I'm dead busy with work at the moment guys, can anyone else try testing the patch in different situations?

lookatthosemoose’s picture

I did not have success with the patch in #9, but a workaround I found was to modify the views-view-fields.tpl.php for the embedded view.
Where the class "views-row-[view field/accordion handle]" is assigned, instead of letting it assign the same class as the accordion headers, simply give it another class.

Example:
My accordion handles are on a view field called "title" from my parent view.
So, the 2nd part of the selector the the accordion will be .views-field-title. (see var: headerSelector line, 43)
My embedded view - the first field is also "title" so in the views-view-fields.tpl.php, modify where class is set to "views-view-title" to read something like "views-view-title-no-accordion."

~line 27 of views-view-fields--[view_name]--[display].tpl.php

<<?php print $field->inline_html;?> class="views-field-<?php print ($field->class=='title') ? "title-no-accordion" : $field->class; ?>">
dkingofpa’s picture

Whoops, my patch in #9 wasn't created correctly (didn't create it from the root of the module directory). As a result, I couldn't use the patch with a drush make file. Re-rolled the patch so it will apply when run from the root of the module.

manuel garcia’s picture

manuel garcia’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)