In Tbgridview How To Show Multiple Model Fields


I have two tables

  1. student (studentId, name, student_rId)

  2. registration (rId, regNumber)

Student_rId and rId is an entity relation of one is to one nature

I have used Crud to generate code

I am facing trouble to show in student view

student.studentId,, registration.regNumber

My code looks as below

<?php $this->widget(‘bootstrap.widgets.TbGridView’,array(












)); ?>


Assuming that CRUD has set up relations for you, then you should be able to access the values from the other table using the relation. Something like:


I’d guess the relation name would be student in your case, so try ‘student.studentId’

No CRUD has not generated any relation code

I tried below code in relation of student model

‘studentReg’ => array(self::HAS_ONE, ‘registration’, ‘rId’)

and used


in TBGridView.array(…




but not getting table content displayed

correct me where I am going wrong

Thanks for helping …