0

I am using views_pre_render hook to edit the result of the view.

My view has a pager system and so the $view->result doesn't give the full list of results. If the pager is set to 10 items, only 10 is obtained in the pre_render. Is there any way I can get the whole set of results?

Any help is much appreciated.

hook_views_post_execute() Also gives only the per page set of values.

thanks.

6
  • Is there any way I can get the whole set of results? well... you would have to turn off the pager or manually query the DB to get all the results which would make the whole point of having a pager pointless. Anyhow, mind tell in us why do you need all the results?
    – No Sssweat
    Commented Feb 19, 2019 at 11:31
  • @nosssweat My view contains different types of values. I need to edit one type of values based on another second type of value but in some of the pages, the second type doesn't get listed. I know the explanation is bad but the scenario is also specific.
    – Bej
    Commented Feb 20, 2019 at 5:55
  • Sounds like then you should query the DB only for the 2nd value that you're looking for. Otherwise, query everything or not having a pager will not be performance friendly.
    – No Sssweat
    Commented Feb 20, 2019 at 6:58
  • @NoSssweat It's a little bit complex to do in the way you suggested. Isn't there any way to get the full list with the pager? Getting data right after the query executes also doesn't give the full result. Does this mean that that the view queries every time and gets only the current page values and not the full set of values?
    – Bej
    Commented Feb 20, 2019 at 12:12
  • 1
    Isn't there any way to get the full list with the pager? there isn't. The whole point of a pager is that it queries the DB and only retrieves x amount of records, this is for performance reasons. Example: If there is 10 million records querying everything would be really slow. Does this mean that that the view queries every time and gets only the current page values and not the full set of values? Correct, as long as there is a pager, it will only get the current page values.
    – No Sssweat
    Commented Feb 20, 2019 at 13:29

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.