mercredi 3 août 2016

Rails - InfiniteAjaxScroll not working while inserting items dynamically into Dom with will paginate

Problem: When appending item through jQuery, infiniteAjaxaScroll is not working.

Used jquery plugin for endless scroll Visit http://ift.tt/1iAGcu8 And Used Filterrific Gem for filter: Demo Link http://ift.tt/1GCWO2i?

Following is code:

post_controller.rb

@posts = Post.paginate(page: params[:page], per_page: 15).order('created_at DESC')

index.html.slim

<pre>
div.new-restaurant-list
 div.new-rest-item
.pagination
</pre>

initializer

var ias = $.ias({
      container: '.new-restaurant-list',
      item: '.new-rest-item',
      pagination: '.pagination',
      next: '.next_page'
    });

index.js.erb

<% js = escape_javascript(
  render(partial: 'restaurant_deals/popular_deal_tab', locals: { popular_restaurants: @popular_restaurants })
) %>
$("#deal-results").html("<%= js %>");

Aucun commentaire:

Enregistrer un commentaire