当前位置: 首页>>代码示例>>PHP>>正文


PHP Column::renderHeaderCellContent方法代码示例

本文整理汇总了PHP中yii\grid\Column::renderHeaderCellContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::renderHeaderCellContent方法的具体用法?PHP Column::renderHeaderCellContent怎么用?PHP Column::renderHeaderCellContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\grid\Column的用法示例。


在下文中一共展示了Column::renderHeaderCellContent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
     }
 }
开发者ID:lianghongle,项目名称:yii2-zh-cn,代码行数:18,代码来源:CheckboxColumn.php

示例2: renderHeaderCellContent

 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || $this->label === null && $this->attribute === null) {
         return parent::renderHeaderCellContent();
     }
     $provider = $this->grid->dataProvider;
     if ($this->label === null) {
         if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQuery) {
             /** @var Model $model */
             $model = new $provider->query->modelClass();
             $label = $model->getAttributeLabel($this->attribute);
         } else {
             $models = $provider->getModels();
             if (($model = reset($models)) instanceof Model) {
                 /** @var Model $model */
                 $label = $model->getAttributeLabel($this->attribute);
             } else {
                 $label = Inflector::camel2words($this->attribute);
             }
         }
     } else {
         $label = $this->label;
     }
     if ($this->attribute !== null && $this->enableSorting && ($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) {
         return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => Html::encode($label)]));
     } else {
         return Html::encode($label);
     }
 }
开发者ID:davidpersson,项目名称:FrameworkBenchmarks,代码行数:29,代码来源:DataColumn.php

示例3: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     if ($this->gridType == 'datatable-select') {
         if ($this->header !== null || !$this->multiple) {
             return Column::renderHeaderCellContent();
         } else {
             $name = rtrim($this->name, '[]') . '_all';
             return Html::checkBox($name, false, ['class' => 'group-checkable']);
         }
     } else {
         return parent::renderHeaderCellContent();
     }
 }
开发者ID:fangface,项目名称:yii2-concord,代码行数:19,代码来源:CheckboxColumn.php

示例4: renderHeaderCellContent

 /**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || !$this->showClear) {
         return parent::renderHeaderCellContent();
     } else {
         $label = ArrayHelper::remove($this->clearOptions, 'label', '×');
         Html::addCssClass($this->clearOptions, 'kv-clear-radio');
         if (empty($this->clearOptions['title'])) {
             $this->clearOptions['title'] = Yii::t('kvgrid', 'Clear selection');
         }
         $this->_view->registerJs("kvClearRadio({$this->_clientVars});");
         return Html::button($label, $this->clearOptions);
     }
 }
开发者ID:GIGS1975,项目名称:yii2-grid,代码行数:17,代码来源:RadioColumn.php

示例5: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkbox($this->getHeaderCheckBoxName(), false, ['class' => 'select-on-check-all']);
     }
 }
开发者ID:milan011,项目名称:yii2,代码行数:14,代码来源:CheckboxColumn.php

示例6: renderHeaderCellContent

 /**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || $this->label === null && $this->attribute === null) {
         return parent::renderHeaderCellContent();
     }
     $label = $this->getHeaderCellLabel();
     if ($this->encodeLabel) {
         $label = Html::encode($label);
     }
     if ($this->attribute !== null && $this->enableSorting && ($sort = $this->grid->dataProvider->getSort()) !== false && $sort->hasAttribute($this->attribute)) {
         return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => $label]));
     } else {
         return $label;
     }
 }
开发者ID:Abbas-Hashemian,项目名称:yii2,代码行数:18,代码来源:DataColumn.php

示例7: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = $this->name;
     if (substr_compare($name, '[]', -2, 2) === 0) {
         $name = substr($name, 0, -2);
     }
     if (substr_compare($name, ']', -1, 1) === 0) {
         $name = substr($name, 0, -1) . '_all]';
     } else {
         $name .= '_all';
     }
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
     }
 }
开发者ID:sx-dev,项目名称:court,代码行数:26,代码来源:CheckboxColumn.php

示例8: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         //            return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
         return "<label class=\"control-label\">" . Html::checkBox($name, false, ['class' => 'select-on-check-all']) . "<span class=\"text\"></span></label>";
     }
 }
开发者ID:lurongze,项目名称:uii20160328,代码行数:19,代码来源:CheckboxColumn.php

示例9: renderHeaderCellContent

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         $content = Html::tag('button', Html::checkBox($name, false, ['class' => 'select-on-check-all', 'data-target' => $this->name, 'data-checkall' => 1, 'data-parent-id' => $id]) . ' <span class="caret"></span>', ['type' => 'button', 'class' => 'btn btn-default dropdown-toggle', 'data-toggle' => 'dropdown']);
         $buttons = preg_replace_callback('/\\{([\\w\\-\\/]+)\\}/', function ($matches) use($model, $key, $index) {
             $name = $matches[1];
             $module = \Yii::$app->user->can(\Yii::$app->controller->module->id . '/' . \Yii::$app->controller->id . '/' . $name);
             if ($module) {
                 if (isset($this->buttons[$name])) {
                     $url = $this->createUrl($name, $model, $key, $index);
                     if (call_user_func($this->checkaccess, $url)) {
                         return call_user_func($this->buttons[$name], $url, $model);
                     } else {
                         return '';
                     }
                 } else {
                     return '';
                 }
             }
         }, $this->template);
         if ($buttons == '') {
             return $buttons;
         }
         $content .= Html::tag('ul', $buttons, ['class' => 'dropdown-menu pull-right', 'role' => 'menu']);
         return Html::tag('div', $content, ['class' => 'dropdown']);
     }
 }
开发者ID:derkamerad,项目名称:adminUI,代码行数:39,代码来源:CheckboxColumn.php


注:本文中的yii\grid\Column::renderHeaderCellContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。