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


PHP Column::init方法代码示例

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


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

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

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

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

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

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

示例6: 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.');
     }
     if (substr($this->name, -2) !== '[]') {
         $this->name .= '[]';
     }
 }
开发者ID:lianghongle,项目名称:yii2-zh-cn,代码行数:14,代码来源:CheckboxColumn.php

示例7: 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.');
     }
     if (substr_compare($this->name, '[]', -2, 2)) {
         $this->name .= '[]';
     }
     $this->registerClientScript();
 }
开发者ID:milan011,项目名称:yii2,代码行数:15,代码来源:CheckboxColumn.php

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

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

示例10: init

 public function init()
 {
     parent::init();
     $this->initDefaultButtons();
 }
开发者ID:jatuponp,项目名称:discovery,代码行数:5,代码来源:CMSColumn.php

示例11: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->name)) {
         throw new InvalidConfigException('The "name" property must be set.');
     }
     $css = $this->rowHighlight ? $this->rowSelectedClass : '';
     $this->_view = $this->grid->getView();
     RadioColumnAsset::register($this->_view);
     $grid = $this->grid->options['id'];
     $this->_clientVars = "'{$grid}', '{$this->name}', '{$css}'";
     $this->_clientScript = "kvSelectRadio({$this->_clientVars});";
     $this->_view->registerJs($this->_clientScript);
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->setPageRows();
 }
开发者ID:GIGS1975,项目名称:yii2-grid,代码行数:20,代码来源:RadioColumn.php

示例12: 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()
 {
     $this->defaultItems = !$this->items;
     parent::init();
 }
开发者ID:microinginer,项目名称:yii2-dropdown-action-column,代码行数:10,代码来源:DropDownActionColumn.php

示例13: init

 public function init()
 {
     parent::init();
     $this->header = Yii::t('easyii', 'Status');
 }
开发者ID:nanodesu88,项目名称:easyii,代码行数:5,代码来源:StatusColumn.php

示例14: init

 public function init()
 {
     parent::init();
     $this->initDefaultItems();
 }
开发者ID:novokshonovev,项目名称:dropdown-action-column,代码行数:5,代码来源:DropDownActionColumn.php

示例15: init

 public function init(){
     if(!class_exists($this->modelClass)){
         throw new HttpException(400, 'Model Class Must Be Set');
     }
     parent::init();
 }
开发者ID:harish-reglobbe,项目名称:Auction,代码行数:6,代码来源:DatabaseColumn.php


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