CGridView selectable keeping selection


How do I maintain the selection when I navigate between pages?

property ‘selectableRows’=>2,

$this->widget('zii.widgets.grid.CGridView', array(




        'selectableRows'=>2,//select more than one




with this

and a little change work fine

Hi Horacio,

Thank you, fixed in last version.

Now user’s CheckBoxColumn gets “checked” value correctly.

I have introduced a small change, again

because it was not good with the previous

declare a global variable in the client widget

and set it in the widget

<script type="text/javascript">

	var selectionGlobal='';

   function show(){

 		alert ("selection="+

    	seleccionGlobal+","+  //stored selection in params

    	$.fn.yiiGridView.getSelection('xxxxx-grid')); //not yet stored in params




$this->widget('application.extensions.SelGridView', array(


the change in SelGridView at the end of protected function applyBeforeAjaxUpdate()


   function applyBeforeAjaxUpdate()




I need help to make this more elegant

for example, $.fn.yiiGridView.getWholeSelection() method


Thanks for this code!

Hi all

I’ve updated SelGridView

Now you can use this method to get all selected keys on all pages:

var selected = $("#mygrid").selGridView("getAllSelection");


I’m new to yii framework and was trying to use Selgridview, to have a table with some contents that later on i will be retrieving them from a noSQL engine. My problem is, i seem not to be able to show the grid in my index page. I tried to use the example code but always keep getting this :

Fatal error: Call to a member function getId() on a non-object in /var/www/front_end/protected/extensions/selgridview/SelGridView.php on line 33

i dont know if its something on my side or if its in SelGridView code.

thanks in advance.


Hi guys,

I wonder why my pager url increasing longer and longer every time i click on the cgridview pager list??


I follow page example on selgridview and demo

thanks man,

//thanks to Horacio Segura 

        foreach($this->columns as $col) {

            if($col instanceof CCheckBoxColumn) {

                $col->checked = $checkedExpression; 





SelGridView.php Line 66.

I just want to notice, that this patch is not a good idea.

When user already have CCheckBox column AND checked property defined - this code overrides user-defined checked property and checkboxes never will be checked. I think there is some other fix needed.


I addeed selgridview and no i can select the all row or the rows i needed .

but i dont know how to pass these array of values to the controller.

All i needed is to pass the values to the controller using a button.

i only found how to add selgridview.

please help me i’m new to yii

thanks in advance

i am new in framework pls help me any one

i can use this selgridview but don’t show the checkbook , what can i do ? what to add in js file

If you want to add selection to selgirdview on pages, you can fill $_GET array in controller, for example:

$_GET['Modelname_sel'] = array(1,2,3,4,5,6,7,8,9,10,21,22,23,24)

it works without extending js file.