I have an accordion view which uses a taxonomy term ID argument. When trying to embed this view twice on a single page (each time with a different value of the term), the formatting is gone completely. Embedding the view only once works as expected.

Comments

jpl-2’s picture

I now separated the view in two pages to avoid a potential id collision. However, the rendering is still unreliable. Apparently the current implementation of the accordion behavior induces a race condition between JavaScript execution and CSS availability (in FF 3.6.8) because it works when I suspend execution at first list of $.each(Drupal.settings.views_accordion, function(id), and sometimes even if I just keep the Firebug console open, but it doesn't work (no formatting) otherwise. Possibly it is also related to my use of JavaScript/CSS compression on admin/settings/performance.

jpl-2’s picture

I also found that disabling the option "Use the module's default styling" helps to avoid the second problem described above. Actually, I'm not sure whether the second problem is a race between JavaScript and CSS or perhaps a race between JavaScript and DOM because when it occurred, the click behavior was not installed either.

timwood’s picture

I've just encountered this situation but with a slightly different setup. Either way, it doesn't seem possible to use this views style plugin twice on one page. jpl, did you come up with a workable solution?

Thanks!

manuel garcia’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Active » Closed (won't fix)

@timwood: It is perfectly possible to use views_accordion twice in the same page. You can see an example of this on my own webpage: http://manueg.okkernoot.net/

As far as embedding the exact same views display TWICE on the same page, I've just tested it and yup, that breaks everything up.

I've taken a look at what's going on... and I consider this bug is going to be FAR too dificult to hunt down for what it is worth... definetly not a priority. It can be easily avoided by having a display/view for each accordion you want to show in a single page at the same time. Even if they are identical and you want to use arguments for them, have them be different displays/views.

I'm sorry but I'm setting this to won't fix. If anyone provides a maintanable patch fixing this it might get in though.

timwood’s picture

I'm unable to use different views/displays because of the way I've configured my site. Here is the setup:

FAQ site. Node type for Question, different node type for Answer. Question has a node reference field which can point to zero or more Answer nodes. I want to display the related Answer nodes in a nice way on the Question node. In the past I've used the Nodereference Views module to accomplish something like this (I think Views attach would do the same/similar). Nodereference Views allows me to set the field display formatter to a view and then customize that view to display the fields I want from the Answer nodes and utilize any views display formatter such as Views accordion.

The sites frontpage is driven by another view which includes Question nodes as full node. Once I add two Question nodes into the system with at least one answer each, the Views accordion breaks because it's appearing on the one page twice from the same view. I assume using Views attach would result in the same problem.

So I guess my question is, how does Views accordion work to apply the javascript to the html? Is there some way to add a unique ID/class to each identical view on the page, either in a tpl or some other way? Could the Views accordion javascript be changed to account for two identical views on a page?

I'm happy to do some digging if you can start me on my way or point me in the right direction.

Thanks

bdone’s picture

a possible solution in the patch waiting for review here: http://drupal.org/node/784126#comment-4740606