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.

  • do you want the remaining part of first page ( 7 items) will be dropped from the result? – Yuseferi Jun 25 at 9:52
  • Yes, I need such 7 items to show on next page along with 3 items (10 ItemsPerPage). – usmanjutt84 Jun 25 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 Jun 25 at 9:56
  • Any suggestion with jQuery? Really appreciate that as I have already wasted much time on that, – usmanjutt84 Jun 25 at 10:01
  • I suggest a solution as an answer. check it and let me know if you need more details and help. I'm here to help drupalist ;) – Yuseferi Jun 25 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.