2015-06-30 101 views
1

我是yii2的新手。我正在試圖將GridView的表格數據放在錨標籤中。Yii2 - GridView - 如何將表格數據包含在html標籤中?

<?= GridView::widget([ 
// is there any property that can be set to achieve this? 
    'dataProvider' => $dataProvider, 
    'filterModel' => $searchModel, 
    'columns' => [ 
     ['class'=>'yii\grid\SerialColumn'], 
     ['attribute' => 'customer_user_name2',], 
    ], 
]); ?> 

的數據應該在HTML頁面中呈現如下

<td> <!-- how to add this? --> <a>data</a> </td> 

感謝。

+0

我已經找到一個stackoverflow路徑來包含表標題內的html標記,但不是表數據[點擊](http://stackoverflow.com/questions/29962373/yii2-how-to-enclose-a-certain- header-in-gridview-by-html-tag) –

+0

此鏈接是kartik-v GridView演示[點擊](http://demos.krajee.com/grid-demo) - 書籍列表中有一列命名爲「作者」,它有一個「hyperReference」,但我不理解GridView配置。 –

+0

我可以通過修改'yii \ grid \ DataColumn'類的$ content變量來實現這一點,但不知道這是否是所需的方法。任何人都可以解釋我? –

回答

相關問題