How to extend PagerRenderer and add additional methods - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to extend PagerRenderer and add additional methods (/showthread.php?tid=80157) |
How to extend PagerRenderer and add additional methods - venance - 09-21-2021 Hello, I'm trying to extend pagination of codeigniter4, so I can be able to use it with ajax. If I add directly my custom method to CodeIgniter\Pager\PagerRenderer, they works fine. But I want to use them through Libraries directory. So I can be able to use like this PHP Code: <?php //html navigation template PHP Code: <?php if ($pager->hasNext()) : ?> Thanks in advance. RE: How to extend PagerRenderer and add additional methods - kenjis - 09-21-2021 It seems there is no way to replace the PagerRenderer class. It is hard coded: https://github.com/codeigniter4/CodeIgniter4/blob/ec5a92540fe674afbca9253aa2056fd479456b14/system/Pager/Pager.php#L123 RE: How to extend PagerRenderer and add additional methods - kenjis - 09-21-2021 You could do it like this: 1. Extend the Pager class to use your PagerRenderer. 2. Replace the Pager class. See https://codeigniter4.github.io/CodeIgniter4/extending/core_classes.html#replacing-core-classes RE: How to extend PagerRenderer and add additional methods - paliz - 09-23-2021 i extend HttpIncoing Class you follow patern to extend pageRender see my codes PHP Code: <?php PHP Code: <?php PHP Code: <?php namespace Modules\Auth\Config; PHP Code: <?php easy peasy extend ci core RE: How to extend PagerRenderer and add additional methods - momox19 - 08-09-2022 I use the solution of Kenjis and it works really well. |