Yii Framework Forum: [Ask] Cara Membuat Gridview Join 4 Tabel - Yii Framework Forum

Jump to content

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

[Ask] Cara Membuat Gridview Join 4 Tabel Rate Topic: -----

#1 User is offline   genbox 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 16-September 13

Posted 23 October 2013 - 06:15 PM

Mau tanya kepada teman-teman yang ada disini, ada yang tau ga caranya menampilkan GridView hasil dari join 4 tabel atau lebih?
0

#2 User is offline   J.J 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 01-April 11

Posted 29 October 2013 - 05:23 AM

Sebenarnya caranya sama aja bro, define aja di masing2 modelnya.

public function relations()
{
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
        'group'=>array(self::BELONGS_TO, 'Group', 'group_id'),
    );
}


Setelah didefine di masing-masing modelnya, define di viewnya/admin.php
    array(
        'name'=>'Group_id',
        'header'=>'Description',
        'value'=>'$data->group["Group_desc"]',
        'filter'=>CHtml::listData(Sp::model()->findAll(), 'group_id', 'group_desc'),
),


Dan define untuk ketiga kolom yang lain dengan menggunakan CGridView dengan cara yang sama.
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