zii.widgets.grid.CGridView - is there an alternative to pagination?

Hi All,

I’ve been playing with zii.widgets.grid.CGridView for a while, find it really amazing, but have a couple of questions so far.

  1. Is this possible to use only ajax-powered links to sort data by clicking on column names? The reason for this is to make sure search engines will not crawl all possible variations of sortings.

  2. The best way to display data in the grid for me would be displaying first 20-30 records and then load the rest with an ajax request if user clicks the link "Show all". Currently I can only provide data in pagination mode, which works very well, but still "Show all" would be much better for me.

Many thanks!

You can add an ajaxLink wich returns a param, for example, show_all and in the action you can:




if (isset($_GET['showAll']))

   $dataProvider->pagination=false;



zaccaria, thank you for your answer! I tried to make this ajax link myself, then tried to find an existing solution, but to no avail. I would be very grateful if you could show me an existing sample (if there is one), or give a few more hints. Sorry, I just started using Yii framework and many things are still unclear, especially Ajax part of it :blink: :unsure:

Maybe this can give you some idea:

http://www.yiiframework.com/forum/index.php?/topic/8994-dropdown-for-pagesize-in-cgridview

Huge thank you Mike! Your code sample indeed helped. I didn’t even think it will be so easy :)