Iam new in yii framework iam using two tables
1- ex_name_details
2-subtype
in my admin view code is
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'ex-name-details-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'name'=>'exSubtype',
),
'exercise_name',
how to fetch instead of exSubtype into subtype table name how to fetch please help
re1nald0
(Reinld17)
June 19, 2013, 7:14am
2
Not 100% sure what you wanted to do, but have you read this wiki? I guess that may be useful for you.
I have using two tables name_details and sub_type , name_table have a foreign key of sub_type table ,now what i want to display sub_type name instead of foriegn key field in name_table ,thats its
Hi
u can try the like below code but make sure u can check the proper relation
array(
'name'=>'liquor_category_id',
'header'=>'Liquor Category',
'value'=>'GxHtml::valueEx($data->LiquorCategory)',
'filter'=>GxHtml::listDataEx(LiquorCategory::model()->findAllAttributes(null, true)),
'htmlOptions' => array('width' => '20%'),
),
i try that way its show the error message shows in my code ,please will find my coding below attached and would
tell me what is wrong
can you attach the table & both the model files… and screen shot of error message.
I am not able to understand, what you are trying to do…
If you want show name instead of id in grid, you need to do change in ‘xecise.php’ as below,
array(
'name'=>'exSubtype',
'type'=>'raw',
'value'=>'CHtml::encode(ModelName::model()->findByPk($data->Sub_Type)->name)'
),
Put actual model name in ‘ModelName’.
I am not able to understand, what you are trying to do…
If you want show name instead of id in grid, you need to do change in ‘xecise.php’ as below,
array(
'name'=>'exSubtype',
'type'=>'raw',
'value'=>'CHtml::encode(ModelName::model()->findByPk($data->Sub_Type)->name)'
),
Put actual model name in ‘ModelName’.
that one is not working ,i attached the screen shot of my gridview how to exercisetype id instead of ExerciseTypeName this two i make foreign key relation pls help anyone