Yii 1.1: mypager

Simple extensions that combines CLinkPager and CListPager in one
8 followers

This is an extremely simple extension that is combining both CListPager and CLinkPager in one, allowing your users to select page of CGridView they want to go to by either clicking on a page button (CLinkPager) or selecting page from a drop down list (CListPager).

Please note: This extension was created for a specific purpose, not for a public domain, so you might find some changes in its code that do not necessary will suit your needs. There are some fixes to some things in base classes that I found wrong (for example - making disabled buttons by only changing their class, but still allowing user to click them), but you may disagree with me. In that case, fill free to drop any additional code out of original extension.

There are some Polish texts hardcoded into this extension. You need to throw them away or change them to use Yii:t for translating purposes. I know that this is a very bad manner and sorry that I wasn't able to do this myself, but I haven't got enough time for doing this when developing this extension.

Unfortunately, do to above circumstances, symbol used to separate CLinkPager from CListPager (mdash) is also hardcoded, you have to change it manually.

Requirements

Since this is a descent from a standard paging class, you do need only framework, even with a very old version of it.

Usage

This is a standard paging component so to use it in a very base manner, all you have to do, is to extend your CGridView configuration with the following line:

'pager'=>array('class'=>'LinkListPager')

Yii, of course must be informed to load proper extension, so you can either add a line like this before your CGridView widget definition:

Yii::import('ext.LinkListPager.LinkListPager');

(providing correct path to the place, where you unpacked this extension.

This is a good approach, if you are using only one or just a few CGridViews with this paging component. If tyou have them more, it is better to force Yii to autoload this extension upon startup by adding following line to your application configuration:

//Autoloading model and component classes
'import'=>array
(
        'application.models.*',
        'application.components.*',
        'application.extensions.*',
        'ext.LinkListPager.LinkListPager'
),

Since this extension descents from CLinkPager, you can use with it any configuration, you would normally use with CLinkPager. For example:

'pager'=>array
(
        'class'=>'LinkListPager',
        'maxButtonCount'=>25,
        'header'=>''
)

Fill free to contact me or leave a comment here, if you have any question related to this extension.

Total 4 comments

#15514 report it
zdzisius at 2013/11/17 04:49pm
'pager'=>array('class'=>'LinkListPager')

in which file ? in which function ?

#13937 report it
r@@j at 2013/07/08 09:41am
Linkpager

i used this extention and got error.

error: Property "CLinkPager.pager" is not defined.

i used in my view this code :

#7409 report it
Shiva Prasad (KTree ) at 2012/03/21 07:59am
don't we have ajax update for CListPager(dropDown)?

Thanks, it is very use full but.. don't we have ajax update for CListPager(dropDown)?

#5305 report it
metall at 2011/10/03 05:57am
Very useful

Thanks, very useful extension

Leave a comment

Please to leave your comment.

Create extension