If I have "display all" in the pager setting, then it works for all rows, even with the exposed filter option selects. But if I limit the display and use a pager, then any row that was not initially displayed will not have the background image applied.

Using Drupal 7.39 with Views 7.x-3.11+26-dev and jquery 1.9.

Comments

kenheim created an issue. See original summary.

kenheim’s picture

Title: Does not work with Ajax » Does not work with Ajax Paging
kenheim’s picture

Priority: Normal » Critical
kenheim’s picture

Issue summary: View changes
Leeteq’s picture

Please verify if it is also a problem with JQuery 1.7 (which is the "most compatible" version as of now). (Just set the JQuery_update module to use 1.7 to do a test.)

koddr’s picture

Similar trouble with Views Infinite Scroll module — this issue.
Please fix it.

Pol’s picture

Could you describe how to reproduce the bug please ?

leahtard’s picture

I am experiencing this with the Views Load More module as well. Here is how it is working for me:

- On page load, I have 6 news items being loaded.
- Each news item has a different background image and it is targeting a class that uses a replacement pattern. ie: node-[node:nid]
- On load, the six unique images are correctly applied to their 6 news items.
- When I click the "Views Load More" button, the 6 new items that appear, do not have background images.

I can see that the inline CSS added to the page only includes the first 6 items. When the ajax call is triggered to load more news items, there are no new classes appended for the new news items.

I hope that provides you will be more specific use case to work with. Happy to help further where I can!

Cheers, Leah

dman’s picture

When you get these symptoms, it's a case of the code using drupal_add_css() - which should be avoided for rendering persistent content. It's not AJAX (or entity/page_cache) safe.

Instead, any code that previously used drupal_add_css() should be refactored to use drupal render() '#attached' property instead.

A description of how to do this is at
https://api.drupal.org/comment/53463#comment-53463

Although the examples usually give a filename for css to add, I'm pretty sure that #attached will also allow you to give it verbatim css to insert when needed.

JParkinson1991’s picture

Did anyone every manage to find a solution to this?

It seems the drupal_add_css calls need to be triggered again on ajax update, but how?

Pol’s picture

Status: Active » Fixed

This should be fixed in latest 8.x-1.2, reopen if not.

Status: Fixed » Closed (fixed)

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