Yii Framework Forum: Visible dan Invisible CButtonColumn di CgridView - Yii Framework Forum

Jump to content

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

Visible dan Invisible CButtonColumn di CgridView Rate Topic: -----

#1 User is offline   John_453P 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 88
  • Joined: 24-March 11

Posted 07 July 2011 - 12:05 AM

para masta yii
saya mohon bantuannya nih
saya punya relasi tabel seperti ini
Attached File  1.JPG (15.75K)
Number of downloads: 13

saya ingi menampilkan CButtonColumn pada tbl_product berdasarkan UserID.
Saya coba seperti ini tapi berlum berhasil, kayaknya butuh relasi untuk visible tapi masih bingung. Ini coding saya

......		
array(		
					'header' => 'Aksi',
					'class'=>'CButtonColumn',
					'buttons'=>array(
								'delete'=>array('visible' => '$data->ProductID == Yii::app()->user->id;',),
								'update'=>array('visible' => '$data->ProductID == Yii::app()->user->id;',),
								'view'=>array('invisible' => '$data->ProductID == Yii::app()->user->id;',),
							)
			),
......

Hasil nya seperti ini.
Attached File  2.JPG (18.49K)
Number of downloads: 15
bagaimana caranya ya? agar sesuai UserID?
0

#2 User is offline   petra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 218
  • Joined: 20-June 10

Posted 07 July 2011 - 12:15 AM

itu bener ProductID-ny yg dicompare sama current user ID?

bukannya harusnya

$data->project->UserID == Yii::app()->user->id;

0

#3 User is offline   -=YiieRz=- 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 177
  • Joined: 27-October 10
  • Location:Jakarta

Posted 07 July 2011 - 01:00 AM

View Postpetra, on 07 July 2011 - 12:15 AM, said:

itu bener ProductID-ny yg dicompare sama current user ID?

bukannya harusnya

$data->project->UserID == Yii::app()->user->id;



ia tu mestinya UserID bukan ProductID :)
belajar itu modal utama, tanpa percobaan itu tak akan berhasil. berdoa itu membuat kita percaya diri. YiieRz-SdgBlajar
www.yiiframework.com
0

#4 User is offline   John_453P 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 88
  • Joined: 24-March 11

Posted 07 July 2011 - 02:28 AM

terimakasih om petra dan YiieRz
kalau saya coba seperti ini

$data->project->UserID == Yii::app()->user->id


hasilnya error
CException
Property "Product.project" is not defined.


itu menurut saya karena field project tidak ada pada tbl_product. :huh:
solusinya bgmn ya?
pada kasus tersebut, tbl_prodduct tidak ada UserID tapi ada pada tbl_project,
jadi inti nya, bagaimana cara mengambil UserID yang ada pada tbl lain?
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