【发布时间】:2016-10-04 07:05:34
【问题描述】:
我在 Yii 2 中创建了一个网格视图,如下所示:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\ActionColumn'],
['class' => 'kartik\grid\SerialColumn'],
['class' => 'kartik\grid\CheckboxColumn'],
'id',
'countrydate',
'countryCode'=>[
'attribute'=>'countryCode',
'content' => function($model,$key,$index, $column) {
return Html::button($model->countryCode,$options = [
'onclick'=>'showcountryCode('.$key.')',
'id'=>'countryCode'.$key,
'class'=>'popup',
]);
}
],
'countryName',
'countrydate',
'population',
'fipsCode',
],
我使用我的 cutson 设置
'countryCode'=>[
'attribute'=>'countryCode',
'content' => function($model,$key,$index, $column) {
return Html::button($model->countryCode,$options = [
'onclick'=>'showcountryCode('.$key.')',
'id'=>'countryCode'.$key,
'class'=>'popup',
]);
}
],
你知道我们可以像这样在 HTML 中互相包含标签:
<a> <h1> asdas </h1> </a>
现在我想在 Html::button 中添加另一个标签,我该怎么做?
【问题讨论】: