Yii Framework Forum: CGridView selectable keeping selection - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CGridView selectable keeping selection How do I maintain the selection when I navigate between pages? Rate Topic: -----

#1 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 15 March 2012 - 10:24 AM

Hi

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

property 'selectableRows'=>2,


$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'expedientes-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'selectableRows'=>2,//select more than one
	'columns'=>array(
        ......


thanks
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#2 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 15 March 2012 - 04:01 PM

with this http://www.yiiframew...on/selgridview/
and a little change work fine



Attached File(s)


KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#3 User is offline   Vitalets 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 16-December 11
  • Location:Moscow / Russia

Posted 16 March 2012 - 03:10 AM

Hi Horacio,

Thank you, fixed in last version.
Now user's CheckBoxColumn gets "checked" value correctly.
have a look on my extensions:
EColumns - show/hide and reorder columns in gridview
GroupGridView - merge cells and make group rows in gridview
SelGridView - keep selection in gridview
0

#4 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 16 March 2012 - 11:13 AM

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
}
</script>
...
$this->widget('application.extensions.SelGridView', array(
 ...



the change in SelGridView at the end of protected function applyBeforeAjaxUpdate()
  ..
   function applyBeforeAjaxUpdate()
   ...
   seleccionGlobal=params[selVar]
   ...



I need help to make this more elegant

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

thanks

Attached File(s)


KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
1

#5 User is offline   jcsmesquita 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 27-July 11

Posted 18 March 2012 - 10:59 PM

Thanks for this code!
0

#6 User is offline   Vitalets 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 16-December 11
  • Location:Moscow / Russia

Posted 19 March 2012 - 03:32 AM

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");

have a look on my extensions:
EColumns - show/hide and reorder columns in gridview
GroupGridView - merge cells and make group rows in gridview
SelGridView - keep selection in gridview
1

#7 User is offline   chmodex 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-March 12

Posted 26 March 2012 - 05:31 AM

Hi,

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.

Tiago.
0

#8 User is offline   jowen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 191
  • Joined: 13-July 11
  • Location:Malaysia

Posted 27 March 2012 - 04:17 AM

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 selgridview and demo

thanks man,
0

#9 User is offline   vitman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 09-April 12

Posted 25 April 2012 - 09:53 AM

//thanks to Horacio Segura http://www.yiiframework.com/extension/selgridview/#c7346 
        foreach($this->columns as $col) {
            if($col instanceof CCheckBoxColumn) {
                $col->checked = $checkedExpression; 
                $col->init();
                return;
            }
        }

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.
0

#10 User is offline   VinodC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-April 12

Posted 05 June 2012 - 03:49 AM

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
0

#11 User is offline   tpandi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 22-May 12

Posted 05 June 2012 - 06:10 AM

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
0

#12 User is offline   Pazi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 03-March 11

Posted 01 August 2012 - 01:52 AM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users