Yii Framework Forum: [ASK] Modifikasi Tabel CRUD - Yii Framework Forum

Jump to content

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

[ASK] Modifikasi Tabel CRUD Rate Topic: -----

#1 User is offline   rayleigh13 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 03-July 12

Posted 16 July 2012 - 10:52 PM

mas saya mau nanya
misalkan data saya ada banyak bgt
dan saya ingin menambahkan opsi last page n first page di halaman admin.php gimana ya?
dan ingin menambahkan multiple delete (ada fitur checklist seperti di phpmyadmin) itu gimana y caranya?
terima kasih mas
0

#2 User is offline   infoxbos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 08-June 12

Posted 18 July 2012 - 03:03 AM

paginationnya diaktifkan saja bos.
masuk ke modelnya. pada function search()
ganti kode :
return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));

menjadi :
return new CActiveDataProvider($this, array('pagination'=>array(
			'pageSize'=> Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']),
			),
			'criteria'=>$criteria,
		));


dan pada config/main.php
tambahkan kode pada :
'params'=>array(
		// this is used in contact page
		
		'defaultPageSize'=>5, //tampil perhalaman

0

#3 User is offline   siskalandre 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 16-March 11
  • Location:Indonesia

Posted 18 July 2012 - 10:32 AM

untuk opsi last page n first page

aktifkan

ul.yiiPager .first,
ul.yiiPager .last
{

}

di file framework\web\widgets\pagers

atau buat css sendiri dan arahkan pagers ke file css tersebut.

untuk multiple delete

di widget

<?php
$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'datagrid',
	'dataProvider'=>$model->searchsdstatus(),
	'filter'=>$model,
    'selectionChanged'=>'showdetail',
    'selectableRows'=>1,
	'template'=>'{pager}<br>{items}{pager}',
	'columns'=>array(
    array(
      'class'=>'CCheckBoxColumn',
      'id'=>'ids',
    ),
	array('name'=>'projectid', 'visible'=>false,'header'=>'ID','value'=>'$data->projectid','htmlOptions'=>array('width'=>'1%')),
	array('name'=>'projectno', 'value'=>'$data->projectno'),
	array('name'=>'soheaderid', 'value'=>'($data->soheader!==null)?$data->soheader->sono:""'),
	'soheader.customer.fullname',
        'projectnote',
		'serviceno',
			array(
      'name'=>'onlinedate',
      'type'=>'raw',
         'value'=>'($data->onlinedate!==null)?date(Yii::app()->params["dateviewfromdb"], strtotime($data->onlinedate)):""'
     ),
    array('header'=>'Status','value'=>'Wfstatus::model()->findstatusname("appproject",$data->recordstatus)')
  ),
));
?>


di controller

public function actionDelete()
	{
		parent::actionDelete();
		$id=$_POST['id'];
		foreach($id as $ids)
		{
		  $model=$this->loadModel($ids);
		  $model->recordstatus=0;
		  $model->save();
		}
		echo CJSON::encode(array(
                'status'=>'success',
                'div'=>'Data deleted'
				));
        Yii::app()->end();
	}


View Postrayleigh13, on 16 July 2012 - 10:52 PM, said:

mas saya mau nanya
misalkan data saya ada banyak bgt
dan saya ingin menambahkan opsi last page n first page di halaman admin.php gimana ya?
dan ingin menambahkan multiple delete (ada fitur checklist seperti di phpmyadmin) itu gimana y caranya?
terima kasih mas

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