CLinkPager on CGridView GoTo First and Last links are set hidden in css

Its strange to see that the links to First and Last page are not visible and are controlled from CSS.

However , I decided to use js instead of CSS to enable them again in CGridView. Here I go :


'pager'=>array(

			'class'=>'CLinkPager',			

			'header'=>'Visit to page',			

			'firstPageLabel'=>'<<',

			'prevPageLabel'=>'<',

			'nextPageLabel'=>'>',	

			'lastPageLabel'=>'>>',

		),

   'afterAjaxUpdate'=>"function(){resetPagerFLK('table_grid');}"





<?php Yii::app()->clientScript->registerScript('initPagelinks',<<<EOD


function resetPagerFLK(gridID){

 var config= $.fn.yiiGridView.settings[gridID];

 var selector='#'+gridID+' div.'+config.pagerClass;

 $(selector).find('li.first,li.last').css({'display':'inline-block'});   

}


//enable links on first load

resetPagerFLK('table_grid');


EOD

,CClientScript::POS_READY); ?>




I would like to hear from you expert people how you come along with this issue in best way and any reason why its set to hide in CSS deliberately ?

This is so-called ‘by design’. ::)

http://www.yiiframework.com/forum/index.php?/topic/4230-clinkpager-first-and-last-buttons

http://www.yiiframework.com/forum/index.php?/topic/8326-clinkpager-enabling-firspagelabel-and-lastpagelabel

IMO, adding some property to CLinkPager in order to control the behavior would be really nice.

But in the mean time, I think that specifying your own CSS would be a straightforward solution when you don’t like the current behavior.

Thanks for the reply ,but I just find it confusing bcz

Is there any bug associated with the page link rendering logic ? Yes/No

  if No , why create a confusion with CSS 


  if YES ,is it fixed in recent version ,and  why CSS is still hiding it 

I know how to fix the css and add mine but look ! we have already added 4+ posts to forum to find WHY this is hidden when it shouldn’t.

In few words: "Unexpected behavior"

However, thanks for the reply.

Hi.

I hope, the first and last links are hidden initially because, you do not have enough pages in your pagination.

Say if you had only 3 pages of information, and all three page links are already available on the pager, there is no meaning in showing first and last links.

Makes sense ?

If you still want to change this behavior, I suggest rather than making the change in css / javascript, directly extend the CLinkpager and override the methods you want.

Do not panic, extending these classes are super easy.

have a look at my post and I hope this would help

http://www.yiiframework.com/forum/index.php/topic/41453-extend-clinkpager-example/