Yii Framework Forum: Cgridview Problem - Yii Framework Forum

Jump to content

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

Cgridview Problem Rate Topic: -----

#1 User is offline   didi0987 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-February 13

Posted 01 March 2013 - 05:44 AM

hi, I'm a newbie to Yii.
I have a problem when I am using CGridView Widget.
On the 'selectionChanged' field,Whenever I tried to click the rows in my table.Nothing happens. Is it should alert the PK value of the row?
<?php 
$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'pLA_Infogrid',
    'dataProvider'=>$model->search(),
		
	'selectionChanged'=>"function(id){alert($.fn.yiiGridView.getSelection(id));}",
	
	'summaryText'=>'',
    'filter'=>$model,
    'columns'=>array(
        'EmployeeID',
        'UserName',
       // 'Password',
        'LastName',
        'FirstName',
        'MiddleInitial',
        'TimeSheetType',
        'FTE',
        array(
            'class'=>'CButtonColumn',
            'template'=>'{update}{delete}',
            'buttons'=>array
            (
//                 'view' => array
//                 (
//                     'url'=>
//                     'Yii::app()->createUrl("Admin/pLA_Info/view/", 
//                                             array("EmployeeID"=>$data->EmployeeID, "UserName"=>$data->UserName
// 											))',
//                 ),
                'update' => array
                (
                    'url'=>
                    'Yii::app()->createUrl("Admin/pLA_Info/update/", 
                                            array("EmployeeID"=>$data->EmployeeID, "UserName"=>$data->UserName
											))',
                ),
                'delete'=> array
                (
                    'url'=>
                    'Yii::app()->createUrl("Admin/pLA_Info/delete/", 
                                            array("EmployeeID"=>$data->EmployeeID, "UserName"=>$data->UserName
											))',
                ),
            ),
        ),
    ),
		
)); 

0

#2 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 289
  • Joined: 23-July 10

Posted 01 March 2013 - 05:53 AM

You missed selecting the grid by id, try
function(id) {
  alert($('#' + id).yiiGridView.getSelection(id));
}

0

#3 User is offline   didi0987 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-February 13

Posted 01 March 2013 - 03:14 PM

View Postkokomo, on 01 March 2013 - 05:53 AM, said:

You missed selecting the grid by id, try
function(id) {
  alert($('#' + id).yiiGridView.getSelection(id));
}


Oh. I got it. Thx. Big life saver
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