Add parameters to CLinkPager


(system) #1

Hi all,

How can I add my owns parameters to the url generated by pagination buttons (CLinkPager)?

Actually  the urls are like this:

app/index.php?r=controller/action&idUser=1

IdUser is from my User model.

The idea is to use various CLinkPager in the same view. I'd like to change the page of one of them (clicking in his button) separately from others CLinkPager in the view.

Manu.


(Qiang Xue) #2

If you want to use multiple pagers on the same page, you need to differentiate them by setting 'pageVar' property of CPagination.

If you want to customize the pagination URLs, you can override CPagination::createPageUrl()


(system) #3

Elegant. It works perfect.

Thankyou Qiang.

Manu.


(Rob Aka Jacky) #4

hi

I am sorry, i am abit new. do you have a sample syntax code for the change?


(Qiang Xue) #5

When you create CPagination instance in your code, you can set:

To override createPageUrl(), please read the code in CPagination and you will see it is very easy.


(Rob Aka Jacky) #6

:-[

I got it working but when link is click it some how transform my url to the % type. need some enlightenment…

I wanted this

view this in html:index.php?r=schedule_run/admin&stat=completed&page=2

but got this when i click on the url

actual url link:index.php?r=schedule_run/admin&stat%3Dcompleted%26page=2

my code



$pages->route='schedule_run/admin';


$pages->pageVar='stat='.$_GET[stat]."&page";



(Mmschlecht) #7

I have the same problem as robrob, has anyone a solution for the problem?


(Sebastianmazur) #8

Hi,

try this:


(Hmsegura) #9

This post is missing "lines"?