在Member模块的index.php中,我点击了id后打开了这个小部件来打开详细信息。但是这里打开一个Url代码,因为它不是url page.please给我解决方案。并建议我使用,因为我不熟悉Yii2。
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'label'=>'practiceCode',
'format' => 'url',
'value'=>function ($data) {
return Html::a(Html::encode("View"),'practice/view');
},
],
'memberCode',
'firstName',
'lastName',
'email:email',
'mobile',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
答案 0 :(得分:1)
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'lable'=>'practiceCode',
'format' => 'raw',
'value'=>function ($model, $index, $widget){
return Html::a($model->practiceCode,['practice/view','id'=>$model->practiceCode],['title'=>'Go!','target'=>'_blank']
);
// return Html::a(Html::encode("View"),'practice/view');
// return Html::a(Html::encode($data- >practiceCode),'practice/view');
},
],
答案 1 :(得分:1)
现在它正在运行'attribute'=>'practiceCode'
而不是'lable'=>'practiceCode',