[Solved] Pagination nav buttons/bar

Just a small question:

In all Yii demos I’ve seen, and in the auto-generated code, the pagination widget button for ‘previous’ page does look like it’s been disabled, but it’s still clickable on page 1.

Same goes for the ‘next’ button when it’s on the last page.


Can you convince that widget to behave properly?

Or do I need to get my hands dirty?

I am just wondering… :)

It’s just not very professional to have a ‘next’ button/link when there’s no ‘next’ …


I am not complaining - just wondering why.

I see that the pagination widget on the Yii Extensions page behaves the same:


That one was easy enough to fix:


class CustomLinkPager extends CLinkPager


	protected function createPageButton($label,$page,$class,$hidden,$selected)


		if($hidden || $selected)

			$class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);


                	return '<li class="'.$class.'"></li>';

            	return '<li class="'.$class.'">'.CHtml::link($label,$this->createPageUrl($page)).'</li>';



And then:

<?php $this->widget('zii.widgets.CListView', array(



    	'pager' => array('class' => 'CustomLinkPager'),

)); ?>