Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- here is is what i have in view/post/admin.php
- <?php $this->widget('zii.widgets.grid.CGridView', array(
- 'id'=>'post-grid',
- 'dataProvider'=>$model->search(),
- 'filter'=>$model,
- 'columns'=>array(
- 'id',
- 'title',
- 'content',
- 'tags',
- array(
- 'name'=>'status',
- 'value'=>'Lookup::item("PostStatus",$data->status)',
- 'filter'=>Lookup::items('PostStatus'),
- ),
- 'create_time',
- 'author_id',
- array(
- 'class'=>'CButtonColumn',
- ),
- ),
- )); ?>
- and i replaced 'author_id' with ,
- array(
- 'name'=>'author_id',
- 'value'=>Lookup::usernme($model->author->id),
- )
- by writing a function in lookup class like this,
- public static function usernme($userid)
- {
- $name = User::model()->findByPk($userid);
- $nme = $name->username;
- return $nme;
- }
- i tried with array('name'=>'author_id', 'value'=>$model->author->username) which didnt worked 4 me
Advertisement
Add Comment
Please, Sign In to add comment