[ * // ... * [ * 'class' => ActionColumn::className(), * // you may configure additional properties here * ], * ] * ``` * * For more details and usage information on ActionColumn, see the [guide article on data widgets](guide:output-data-widgets). * * @author Qiang Xue * @since 2.0 */ class DiyActionColumn extends ActionColumn { public $header = '操作'; public $headerOptions = ['class' => 'action-column','style'=>'min-width:135px']; /** * Initializes the default button rendering callback for single button * @param string $name Button name as it's written in template * @param string $iconName The part of Bootstrap glyphicon class that makes it unique * @param array $additionalOptions Array of additional options * @since 2.0.11 */ protected function initDefaultButton($name, $iconName, $additionalOptions = []) { if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) { $this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) { switch ($name) { case 'view': $title = Yii::t('yii', 'View'); break; case 'update': $title = Yii::t('yii', 'Update'); break; case 'delete': $title = Yii::t('yii', 'Delete'); break; default: $title = ucfirst($name); } $options = array_merge([ 'title' => $title, 'aria-label' => $title, 'data-pjax' => '0', 'class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', ], $additionalOptions, $this->buttonOptions); return Html::a($title, $url, $options); }; } } }