2

I am using views_infinite_scroll module to load more nodes with 10 nodes on every click and views AJAX is enabled.

I am working on a requirement like as, I have 100 total nodes and getting in a view page. On first load, I need to show 3 nodes and on load more load next 10 nodes.

  if(!$view->getPager()->getCurrentPage()){
    $view->setItemsPerPage(3);
  }

I know above code should work in such case. But the problem is "next page doesn't include 4-10 nodes while it will show nodes from 11-20 (next 10 nodes). I need to load ignored 7 nodes (4-10) should also appears on next page (?page=1) along with next 3 nodes (11-13).

I have tried hook_views_pre_render, hook_views_post_render, hook_views_pre_build, hook_views_post_build, hook_views_query_alter etc. but no success to load ignored nodes on next page (?page=1) while load more using AJAX.

Any kind of help or suggestion would be appreciated.

7
  • do you want the remaining part of first page ( 7 items) will be dropped from the result?
    – Yuseferi
    Commented Jun 25, 2020 at 9:52
  • Yes, I need such 7 items to show on next page along with 3 items (10 ItemsPerPage). Commented Jun 25, 2020 at 9:55
  • don't waste your time on the handle it with Drupal side. I suggest handling it by the FE side, Jquery will be a good candidate.
    – Yuseferi
    Commented Jun 25, 2020 at 9:56
  • Any suggestion with jQuery? Really appreciate that as I have already wasted much time on that, Commented Jun 25, 2020 at 10:01
  • 1
    Looks like there's an open issue with a patch to add this functionality on d.o.
    – sonfd
    Commented Jun 25, 2020 at 12:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.