LinkPager for GridView with custom URL

Hi there,

I have a GridView with a LinkPager and I need to set the URL it uses in the Links to a different one to what is used automatically.

The only way I could find so far is extending LinkPager and overriding renderPageButton().

Is there an easier way to do this or have I missed something!?

Many thanks for any hints!

What kind of urls do you want to create with the link pager?

Just a URL to a different action but still in the same controller and with some added parameters.

Did you try "filterUrl" of the grid to achieve your goal?$filterUrl-detail

Thanks, just tried it but it does not seem to have any effect on the LinkPager. That still uses the current controller action as before :(

Any other ideas?

Maybe you are right to say so, but I’m not quite sure.

Would you please explain your design a bit with more details?

What are the added parameters like?

And does a link in the pager update the grid via pjax or ajax, or does it load a new page in a normal manner?

My design is as follows…

I have a page with 4 tabs (yii\bootstrap\Tab). Each tab has a GridView and is updated via Pjax but is initially partially rendered directly into the items[].

With this design all 4 GridsViews use the same action for the LinkPager and LinkSorter which leads to all, apart from the first tab, not working correctly.

However, I’ve now changed the design and load each tab separately when it gets activated for the first time, using the “” event of the tabs. This way the route for the GridView is correct for each of them and it appears to be working how I want it to.

So again, thanks for your help and I guess this is solved now, even though not the way I first thought ;)