Yii bootstrap extension & grids

Hello,

I try to use the grid from Yii Bootstrap extension, but i fail.

I tried to use the CArrayDataProvider class to get the data from my table as follow in the controller :




$user_model = User::model()->findAll();

$data_provider = new CArrayDataProvider($user_model);



and then in the view :




$this->widget('bootstrap.widgets.BootGridView', array(

    'type'=>'striped bordered condensed',

    'dataProvider'=>$data_provider ,

    'template'=>"{items}",

    'columns'=>array(

       ...

));



But it doesn’t seem to be working because my User table is not using any ID column (username is my primary key).

So I tried with :




$data_provider = new CActiveDataProvider('User');



And that worked great !!

But I want to use the relation between the User table and the Profile table and I can’t do this with a CActiveDataProvider.

So i’m back with the CArrayDataProvider like :




$user_model = User::model()->with('profile')->findAll();

$data_provider = new CArrayDataProvider($user_model);



And again, I have this error about no ID found !

Can someone help me ?

Thanks,

Maxime.

Ok nevermind !

I found the way to get relation with the CActiveDataProvider just like this :




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

         'criteria'=>array(

         'with' => array('profile'),

     ),

));



But now I don’t know how to diplay the colums from the relationned table (Here Profile).

I tried :




<?php $this->widget('bootstrap.widgets.BootGridView', array(

    'type'=>'striped bordered condensed',

    'dataProvider'=>$data_provider,

    'template'=>"{items}",

    'columns'=>array(

        array('name'=>'username', 'header'=>Yii::t('user', 'model.user.username')),

        array('name'=>'created', 'header'=>Yii::t('user', 'model.user.created')),

        array('name'=>'firstname', 'header'=>Yii::t('user', 'model.profile.firstname')), //Firstname is in the Profile table

        array(

            'class'=>'bootstrap.widgets.BootButtonColumn',

            'htmlOptions'=>array('style'=>'width: 50px'),

        ),

    ),

)); ?>



But is get the following error : the property User.firstname is not defined.

Thanks,

Maxime.

Never mind it’s all written in the CGridView class xD