本文整理汇总了PHP中kartik\grid\GridView::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::classname方法的具体用法?PHP GridView::classname怎么用?PHP GridView::classname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\grid\GridView
的用法示例。
在下文中一共展示了GridView::classname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
/** @inheritdoc */
public function bootstrap($app)
{
$configManager = Yii::$app->configManager;
$configManager->register('userGrid', GridView::classname(), ['persistResize' => true, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true, 'loadingCssClass' => false, 'options' => ['scrollTo' => 0]], 'striped' => true, 'condensed' => false, 'bordered' => false, 'layout' => '
<div class="box-body">
{items}
</div>
<div class="box-footer clearfix">
<div class="pull-right">
{pager}
</div>
<div class="pull-left summary-wrapper">
{summary}
</div>
</div>']);
$configManager->register('userGridNameColumn', GridView::classname(), ['attribute' => 'username', 'format' => 'raw', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
return Html::a(isset($model->profile) ? $model->profile->name . ' (' . $model->username . ')' : $model->username, ['/management/user/update', 'id' => $model->id], ['data-pjax' => 0, 'data-toggle' => 'tooltip', 'data-placement' => 'right', 'data-html' => 'true', 'data-trigger' => 'hover click', 'title' => '<i class="glyphicon glyphicon-edit"> </i>' . ' ' . Yii::t('app', 'Edit')]);
}]);
$configManager->register('userGridBlockColumn', GridView::classname(), ['header' => 'Block status', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
if ($model->is(User::BLOCKED)) {
return Html::a('<i class="fa fa-unlock"></i>' . ' ' . 'Unblock', ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block btn-flat', 'data-method' => 'post']);
} else {
return Html::a('<i class="fa fa-lock"></i>' . ' ' . 'Block', ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-danger btn-block btn-flat', 'data-method' => 'post']);
}
}]);
$configManager->register('userGridRoleColumn', GridView::classname(), ['header' => 'Role', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
return !empty(Yii::$app->authHelper->getRoleNameByUserId($model->id)) ? Html::tag('span', Yii::$app->authHelper->getRoleNameByUserId($model->id), ['class' => "label bg-default label-default"]) : null;
}]);
}
示例2: init
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
$dp = static::slash(BaseDataProvider::className());
if (empty($this->dataProvider) || !$this->dataProvider instanceof BaseDataProvider) {
throw new InvalidConfigException("The 'dataProvider' property must be set and must be an instance of '{$dp}'.");
}
$kvGrid = static::slash(GridView::classname());
if (empty($this->gridClass)) {
$this->gridClass = $kvGrid;
} elseif ($this->gridClass !== $kvGrid && !is_subclass_of($this->gridClass, $kvGrid)) {
throw new InvalidConfigException("The 'gridClass' must be a class which extends from '{$kvGrid}'.");
}
$this->initOptions();
$this->registerAssets();
}