GridView

Hi all

any one tell me how can i implement gridview??

If you would give more information maybe someone could help you…

Do you mean CGridView… check the documentation… there is an example…

And the code generated by Gii uses CGridView in the actionAdmin()

hi

im having trouble with delete action with CButtonColumn inside a Grid


	<?php 

		$dataProvider=new CActiveDataProvider('User', array(

			'pagination'=>array(

        		'pageSize'=>50,

    		),

		));

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

			'dataProvider'=>$dataProvider,

			

			'columns'=>array(

				'id:text:ID',

				'status:text:Status',

				'username:text:Username',

				//'password:text:Password',

				'email:text:Email',

				'phone:text:Phone',

				'name:text:Name',

				'street:text:Street',

				'birthday:text:Birthday',

				'money:text:Money',

				'invested:text:Inv.',

				'investedtimes:text:IT.',

				'since:text:Since',

				array(

					'class'=>'CButtonColumn',

					'header'=>'Options',

					'template'=>'{update}{delete}',

					'updateButtonUrl'=>'Yii::app()->createUrl("admin/users/update/".$data->id)',

					'deleteButtonUrl'=>'Yii::app()->createUrl("admin/users/delete/".$data->id)',

				),

			),

		));

	?>



Scripts:


/*<![CDATA[*/

jQuery(function($) {

jQuery('#yw0 a.delete').live('click',function() {

	if(!confirm('Are you sure you want to delete this item?')) return false;

	$.fn.yiiGridView.update('yw0', {

		type:'POST',

		url:$(this).attr('href'),

		data:{ 'YII_CSRF_TOKEN':'905fa8c11bfdbc64933d91044bfc9e0c0a7cab62' },

		success:function() {

			$.fn.yiiGridView.update('yw0');

		}

	});

	return false;

});

jQuery('#yw0').yiiGridView({'ajaxUpdate':['yw0'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items','selectableRows':1,'pageVar':'User_page'});

jQuery('#dialog_AboutUs').dialog({'title':'Acerca','autoOpen':false,'modal':true,'width':'700','resizable':false});

jQuery('#dialog_OurGuarantee').dialog({'title':'Garantias','autoOpen':false,'modal':true,'maxWidth':600});

jQuery('#dialog_Privacy').dialog({'title':'Privacidade','autoOpen':false,'modal':true,'maxWidth':600});

});

/*]]>*/

</script> 

Action:


public function actionUsers()

	{

		if(Yii::app()->request->isAjaxRequest)

		{

			$fp = fopen('text.txt', 'w');

			fwrite($fp, print_r($_GET, true));

			fwrite($fp, sizeof($_REQUEST));

			foreach($_POST as $value => $key)

				fwrite($fp, $key);

			fclose($fp);

			return true;

		}

		else

			$this->render('users');

	}

output on txt:


Array

(

    [ajax] => yw0

)

1

how could i recive the post id to remove a user from list?

thanks