當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GridView::classname方法代碼示例

本文整理匯總了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>' . '&nbsp;&nbsp;' . 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>' . '&nbsp;&nbsp;' . '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>' . '&nbsp;&nbsp;' . '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;
     }]);
 }
開發者ID:asiborro,項目名稱:yii2-management,代碼行數:30,代碼來源:Bootstrap.php

示例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();
 }
開發者ID:kartik-v,項目名稱:yii2-builder,代碼行數:20,代碼來源:TabularForm.php


注:本文中的kartik\grid\GridView::classname方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。