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


PHP grid\Column类代码示例

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


在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     /* @var $dataProvider ActiveDataProvider */
     $dataProvider = $this->grid->dataProvider;
     if (!$dataProvider instanceof ActiveDataProvider) {
         throw new InvalidConfigException('SortableColumn works only with ActiveDataProvider.');
     }
     if (!$this->gridContainerId) {
         throw new InvalidConfigException('$gridContainerId property must be set.');
     }
     Yii::setAlias('@sortable', dirname(__DIR__));
     Yii::$app->i18n->translations['sortable'] = ['class' => PhpMessageSource::className(), 'basePath' => '@sortable/messages'];
     /* @var $query \yii\db\ActiveQuery */
     $query = $dataProvider->query;
     $this->_model = new $query->modelClass();
     $this->contentOptions = function ($model) {
         /* @var $model ActiveRecord|BaseNumericalSortableBehavior */
         return ['class' => 'sortable-cell', 'data-position' => $model->getSortablePosition()];
     };
     if (!$this->header) {
         $this->header = Yii::t('sortable', 'Sort');
     }
     $this->visible = $this->isVisible();
     if (!$this->template) {
         $this->template = '<div class="sortable-section">{currentPosition}</div>
         <div class="sortable-section">{moveWithDragAndDrop}</div>
         <div class="sortable-section">{moveForward} {moveBack}</div>
         <div class="sortable-section">{moveAsFirst} {moveAsLast}</div>';
     }
     $this->initDefaultButtons();
     if (!Yii::$app->request->isAjax) {
         $this->registerJs();
     }
 }
开发者ID:arogachev,项目名称:yii2-sortable,代码行数:38,代码来源:SortableColumn.php

示例3: renderFilterCellContent

 protected function renderFilterCellContent()
 {
     $filter = $this->guessFilter();
     if ($filter instanceof BaseFilter) {
         return $filter->render();
     }
     return Column::renderFilterCellContent();
 }
开发者ID:omnilight,项目名称:yz2-admin,代码行数:8,代码来源:DataColumn.php

示例4: 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

示例5: function

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Создать номер', ['create'], ['class' => 'btn btn-success']);
?>
        <?php 
echo Html::a('Загрузить из файла', ['uploadform'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
$cols = [['class' => 'yii\\grid\\SerialColumn'], 'id', 'voip_number', ['attribute' => 'secret', 'value' => function ($model) {
    return Html::a($model->secret ? '* * *' : '', '', ['title' => $model->secret]);
}, 'format' => 'raw'], 'description', 'context', ['class' => Column::className(), 'content' => function ($model) use($id_wp) {
    return Html::a('Выбрать', ['voipnumbers/choicewp', 'id' => $model->id, 'id_wp' => $id_wp]);
}], ['class' => 'yii\\grid\\ActionColumn']];
if (!isset($id_wp)) {
    unset($cols[6]);
}
?>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $cols]);
?>

</div>
开发者ID:Griff19,项目名称:it_base,代码行数:30,代码来源:index.php

示例6: function

<?php

/**
 * User: ivan
 * Date: 09.02.2016
 * Time: 12:31
 *
 * @var $this yii\web\View
 * @var $dp yii\data\ActiveDataProvider
 */
use yii\grid\GridView;
use yii\helpers\Html;
use yii\grid\Column;
use backend\models\Devices;
$this->title = '' . $title;
$this->params['breadcrumbs'][] = ['label' => 'Отчет', 'url' => ['reports/aindex']];
$this->params['breadcrumbs'][] = $this->title;
echo 'Отчет по устройству';
echo '<h1>' . $title . '</h1>';
echo GridView::widget(['dataProvider' => $dp, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'branch_id', 'label' => 'Подразделение'], ['attribute' => 'workplaces_title', 'label' => 'Рабочее место', 'value' => function ($dp) {
    return Html::a($dp['workplaces_title'], ['workplaces/view', 'id' => $dp['workplace_id']]);
}, 'format' => 'raw'], ['class' => Column::className(), 'header' => 'Кол-во', 'content' => function ($dp) use($type_id) {
    return Devices::getCountOnWp($type_id, $dp['workplace_id']);
}], ['attribute' => 'snp', 'label' => 'Ответственное лицо'], ['attribute' => 'job_title', 'label' => 'Должность'], ['attribute' => 'date', 'label' => 'Дата']]]);
开发者ID:Griff19,项目名称:it_base,代码行数:24,代码来源:a_employee.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: init

 /**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException if [[name]] is not set.
  */
 public function init()
 {
     parent::init();
     if (empty($this->name)) {
         throw new InvalidConfigException('The "name" property must be set.');
     }
 }
开发者ID:kilyanov,项目名称:yii2,代码行数:11,代码来源:RadioButtonColumn.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $script = '
     $(document).ready(function(){
         function hideFirstLast() {
             $(\'.sort-up, .sort-down\').show();
             $(\'.sort-up\').first().hide();
             $(\'.sort-down\').last().hide();
         }
         function refresh() {
             $(\'#' . $this->grid->id . '\').yiiGridView("applyFilter");
             hideFirstLast();
         }
         $(\'.sort-up\').on(\'click\', function(){
             var id = $(this).parent().parent().attr(\'data-key\');
             $.post("' . Url::toRoute(['swap']) . '?id="+id+"&dir=up").always(refresh);
             return false;
         });
         $(\'.sort-down\').on(\'click\' ,function(){
             var id = $(this).parent().parent().attr(\'data-key\');
             $.post("' . Url::toRoute(['swap']) . '?id="+id+"&dir=down").always(refresh);
             return false;
         });
         hideFirstLast();
     });';
     $this->grid->getView()->registerJs($script);
 }
开发者ID:alisherdavronov,项目名称:yii2-grid-sort-column-enh,代码行数:31,代码来源:SortColumn.php

示例11: init

 /**
  * Initializes the object.
  * This method is invoked at the end of the constructor after the object is initialized with the
  * given configuration.
  */
 public function init()
 {
     if ($this->defaultItems) {
         $this->defaultItems = [['label' => Yii::t('yii', 'Update'), 'url' => ['update', 'id' => '{id}']], ['label' => Yii::t('yii', 'View'), 'url' => ['view', 'id' => '{id}']], ['label' => Yii::t('yii', 'Delete'), 'url' => ['delete', 'id' => '{id}']]];
     }
     parent::init();
 }
开发者ID:zulkifl,项目名称:yii2-dropdown-action-column-1,代码行数:12,代码来源:DropDownActionColumn.php

示例12: init

 public function init()
 {
     parent::init();
     $this->defaultButtons = [['url' => 'edit', 'icon' => 'pencil', 'class' => 'btn-primary', 'label' => Yii::t('app', 'Edit')], ['url' => 'delete', 'icon' => 'trash-o', 'class' => 'btn-danger', 'label' => Yii::t('app', 'Delete'), 'options' => ['data-action' => 'delete']]];
     if (null === $this->buttons) {
         $this->buttons = $this->defaultButtons;
     } elseif ($this->buttons instanceof Closure) {
         $this->callbackButtons = $this->buttons;
     }
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:10,代码来源:ActionColumn.php

示例13: renderHeaderCellContent

 /**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     if ($this->label !== null) {
         return $this->label;
     }
     if ($this->attribute !== null) {
         $model = $this->grid->filterModel;
         return $model->getAttributeLabel($this->attribute);
     }
     return parent::renderHeaderCell();
 }
开发者ID:wrt54gl,项目名称:yii2-tabular,代码行数:14,代码来源:InputColumn.php

示例14: init

 /**
  * @inheritDoc
  */
 public function init()
 {
     parent::init();
     /**
      * @var ActiveDataProvider $provider
      * @var ActiveQuery        $query
      */
     $provider = $this->grid->dataProvider;
     Yii2::assertType($provider, ActiveDataProvider::class);
     $query = $provider->query;
     Yii2::assertType($query, ActiveQuery::class);
     $this->provider = $provider;
     $this->query = $query;
 }
开发者ID:nanodesu88,项目名称:yii2-activerecord-sort,代码行数:17,代码来源:SortColumn.php

示例15: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $view = $this->grid->getView();
     $script = '
     $(document).ready(function(){
         function hideFirstLast() {
             $(\'.sort-up, .sort-down\').show();
             $(\'.sort-up\').first().hide();
             $(\'.sort-down\').last().hide();
         }
         $(\'.sort-up\').on(\'click\', function(){
             var element = $(this).parent().parent();
             var id1 = element.attr(\'data-key\');
             var id2 = element.prev().attr(\'data-key\');
             element.prev().before(element);
             hideFirstLast();
             $.ajax({
                 url: "' . Url::toRoute(['swap']) . '?idFrom="+id1+"&idTo="+id2
             });
             return false;
         });
         $(\'.sort-down\').on(\'click\' ,function(){
             var element = $(this).parent().parent();
             var id1 = element.attr(\'data-key\');
             var id2 = element.next().attr(\'data-key\');
             element.next().after(element);
             hideFirstLast();
             $.ajax({
                 url: "' . Url::toRoute(['swap']) . '?idFrom="+id1+"&idTo="+id2
             });
             return false;
         });
         hideFirstLast();
     });';
     $view->registerJs($script);
 }
开发者ID:greshnik,项目名称:yii2-grid-sort-column,代码行数:40,代码来源:SortColumn.php


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