[EXTENSION] SelGridView

Hi,

this is the topic for SelGridView extension.

It allows to:

  • remember selected rows on sorting / paging grid

  • select rows programmatically by GET param (e.g. to highlight new record)

Feel free to make suggestions or report a bug.

Hi guys,

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

http://localhost/…mygrid/user_sel[2]/2/user_sel[3]/2/user_sel[4]/2

I follow page example on selgridviewand demodemo


$this->widget('ext.selgridview.SelGridView', array(

    'id' => 'mygrid',

    'dataProvider' => $dataProvider,

    'selectableRows' => 1,

    'columns' => array(

        'id',

        'email',

    ),

));

How to set double click in cgridview? Thx alot.

thanks man,

Is there a selGridView.update function analogous to yiiGridView.update?

Also, is there a way to select ALL rows, rather than just all rows on the current page?

TIA,

F.

Actually, it seems you can still use the yiiGridView.update on a selGridView widget.

I still would like to be able to select ALL rows. Anybody?

Hi franko!

  1. Sure, you can use yiiGridView.update on SelGridView widget, as second extends first.

  2. Select all rows on all pages is not a simple task.

Grid really does not know what particular rows are on other pages. When user clicks on row - we can remember the row - and that’s way SelGridview works. But to select all rows we should make some extra request to server, now I do not see an elegant solution to perform it. :unsure:

Yeah, I couldn’t figure out an easy way to do it either, so I went around it instead. Thanks for the reply!

Hi,

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

Great extension. But how can I set checked values? For example, on update action that I need to retrieve saved checked IDs.

On zii CGridView we use this approach:

(http://www.yiiframework.com/forum/index.php/topic/8667-ability-to-pre-populate-checked-value-in-ccheckboxcolumn/page__view__findpost__p__148525):

//Controller

$rowSelection = ‘in_array ($data->id,array (’.($_POST[‘my -grid_c0’] ?

        implode(',', $_POST['my -grid_c0']) : '').'))';

//Grid

‘columns’=>array (

  array (


   'class'=>'CCheckBox Column',


   'checked'=>$rowSelection,


  ),


  ...

Is that possible to use POST method instead of GET method? Cause in some situations I’m getting “The requested URL’s length exceeds the capacity limit for this server”.

yes, it not working for me either… but it would be necessary.

anyway it’s a good extension, but please fix this error, thanks a lot!

This extension don’t work for me i am getting the error

Property "CCheckBoxColumn.checked" is not defined

source file

/home/inder/etc/php_apps/www/inder.z/public_html/admin/protected/extensions/selgridview/SelGridView.php(70)

Solved:

In controller put this line before render:




$_GET['ModelClassName_sel'] = isset($_GET["ModelClassName_sel"]) ? $_GET["ModelClassName_sel"] : (count($arrayWithIdsMustBeChecked) > 0 ? $arrayWithIdsMustBeChecked : false);



And before form submit set a hidden field to get all checked in pagination




$('#HiddenFieldName').val($('#GridName').selGridView('getAllSelection'));



Hi, i having the same problem with @jowen.

The url is getting longer and longer when url manager is enabled. But it’s normal if url manager is disabled.

Hope someone find the solution.

Many thanks,

Segi Henggana

How do I submit all selected rows from different pages? I have found it’s only submitting selected rows from active page. In browser console I have found it’s generating URL with all selected rows.

Is there any way that can help me to submit form with all selected rows from different pages?

Thanks in advance

Hi is there any way to exclude some rows from selection?

I’ve tried selectableRows=>0 per row, that wont work.

I’ve tried the disabled option, that disables the checkbox, but won’t prevent that it will be checked when the main checkbox in the header is ticked or when the row is selected.

I’ve tried to make it hidden with css by using the cssClassExpression, that makes is hidden, but still it will be selected in the background.

What else could I try?

I want that finished tasks can’t be checked, only the open tasks in my system.

Maybe if CCheckBoxColumn.visible could accept a PHP expression I could use that, but it only accept boolean. :(

I am having some issues with this extension…

On page load I am dynamically setting rows to be checked with the following code (this works perfectly).


<?php $this->widget('ext.selgridview.BootSelGridView',array(

                'id'			=> 'students-grid',

                'type'			=> 'striped bordered condensed',

                'dataProvider' => new CArrayDataProvider($model->getAvailableStudents(), array(

                        'keyField' => 'user_id'

                    )),

                'selectableRows' => 1,

                'columns' => array(

                    array(

                        'id' => 'user_id',

                        'class' => 'CCheckBoxColumn',

                        'checked' => 'in_array($data->user_id, $this->grid->owner->model->student_ids)',

                        'checkBoxHtmlOptions' => array(

                            'name' => get_class($model)."[students][]"

                        )

                    ),

                    'user_id',

                    'firstname',

                    'surname',

                    'username'

                )

            )); ?>



My problem is when I check a checkbox and then navigate to another page in the recordset and return back to the original page in the recordset the checkboxes that I have manually just checked have been removed :(

Can anyone assist me with this, my urlFormat in my config is currently set to ‘path’ - do I need to change this for it to work fully?

Any advice would be much appreciated