DetailView Value of column Problem

I get an error when I use a function to get the value of column and its working normally using Gridview what I’m doing wrong ???

<?= DetailView::widget([

    'model' =&gt; &#036;model,


    'attributes' =&gt; [


              [


          'label' =&gt; 'subject_type',


          'value' =&gt; function(&#036;data){return Lookup::item(&quot;SubjectType&quot;,&#036;data-&gt;subject_type);},


          'filter' =&gt; Lookup::items('SubjectType'),


        ],


     id,


     subject_nature,


    ],


    ]) ?&gt;

Yes because ‘value’ attribute is a real value or attribute name, as doc says

http://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html#$attributes-detail

So your code should be:




<?= DetailView::widget([

'model' => $model,

'attributes' => [

[

'label' => 'subject_type',

'value' => 'Lookup::item("SubjectType",$model->subject_type);',

'filter' => Lookup::items('SubjectType'),

],

id,

subject_nature,

],

]) ?>



Thanks a lot You save my effort