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


PHP DataColumn::init方法代码示例

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


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

示例1: init

    /**
     * @inheritdoc
     */
    public function init()
    {
        $script = <<<JS
jQuery(document).on('click', '.order-link', function(e) {

    e.preventDefault();
    var csrfToken = \$('meta[name="csrf-token"]').attr("content");
    var url = jQuery(this).attr('href');
    var obj = this;
    jQuery.ajax({
       method: 'post',
       url: url,
       data: {_csrf: csrfToken},
       success: function(data) {

           jQuery('#'+jQuery( obj ).closest( ".grid-view" ).attr('id')).yiiGridView("applyFilter");
       }
    });
});
JS;
        $view = $this->grid->getView();
        GridViewAsset::register($view);
        $view->registerJs($script);
        parent::init();
        // TODO: Change the autogenerated stub
    }
开发者ID:Wubbleyou,项目名称:yii2-ordermodel,代码行数:29,代码来源:OrderModelColumn.php

示例2: init

 public function init()
 {
     parent::init();
     if (!isset($this->headerOptions['width'])) {
         $this->headerOptions['width'] = $this->width;
     }
 }
开发者ID:phpsong,项目名称:lulucms2,代码行数:7,代码来源:DataColumn.php

示例3: init

 public function init()
 {
     parent::init();
     if (!$this->filter) {
         $this->filter = \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name');
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:7,代码来源:SiteColumn.php

示例4: init

 public function init()
 {
     parent::init();
     $this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
         return Html::a($model->{$column->attribute}, ['view', 'id' => $model->primaryKey], ['title' => Yii::t('common', 'View')]);
     };
 }
开发者ID:dersonsena,项目名称:yii2-common-classes,代码行数:7,代码来源:LinkDataColumn.php

示例5: init

 public function init()
 {
     if (!Yii::$app->getRequest()->getIsAjax()) {
         DropdownAsset::register($this->grid->getView());
     }
     parent::init();
 }
开发者ID:ivan-chkv,项目名称:yii2-mozayka,代码行数:7,代码来源:DataColumn.php

示例6: init

 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $this->setDefaultOptions();
     $this->setCellStyleOptions();
     $this->initOptions();
     $this->grid->view->registerJs($this->sortButtonJs());
 }
开发者ID:gpis88ce,项目名称:Gpis88ce,代码行数:11,代码来源:SorterColumn.php

示例7: init

 public function init()
 {
     parent::init();
     $model = $this->grid->filterModel;
     if ($model) {
         $this->filter = $model->getPossibleStatuses();
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:8,代码来源:StatusColumn.php

示例8: init

 public function init()
 {
     parent::init();
     if (!isset($this->headerOptions['width'])) {
         $this->headerOptions['width'] = $this->width;
     }
     $this->contentOptions = ['style' => 'word-wrap: break-word; word-break: break-all;'];
 }
开发者ID:sym660,项目名称:lulucms2,代码行数:8,代码来源:DataColumn.php

示例9: init

 public function init()
 {
     $this->headerOptions = ['class' => 'text-center', 'style' => 'width: 115px'];
     $this->contentOptions = ['class' => 'text-center'];
     parent::init();
     $this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
         return ControllerBase::getYesNoLabel($model->{$column->attribute});
     };
 }
开发者ID:dersonsena,项目名称:yii2-common-classes,代码行数:9,代码来源:YesNoDataColumn.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->ajaxOptions['type'])) {
         $this->ajaxOptions['type'] = 'POST';
     }
     $this->ajaxOptions['data'] = new \yii\web\JsExpression('data');
     $this->grid->view->registerJs("\$('.editableCell').change(function() {\n                data = {};\n                data[\$(this).attr('name')] = \$(this).val();\n                submitAttributes = \$(this).data('submit-attributes').split(',');\n                for (var i in submitAttributes) {\n                    data[submitAttributes[i]] = \$(this).data('attribute'+i);\n                }\n                data['dropDownColumnSubmit'] = true;\n                \$.ajax(" . \yii\helpers\Json::encode($this->ajaxOptions) . ");\n        });");
     return parent::init();
 }
开发者ID:SimonBaeumer,项目名称:humhub,代码行数:12,代码来源:DropDownGridColumn.php

示例11: init

 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Html::a($model->getCategoryTag(), '/search?iht=' . $model->category_id, ['title' => 'Browse ' . $model->getCategoryTag() . ' torrents']);
         };
     }
 }
开发者ID:MaizerGomes,项目名称:openbay,代码行数:10,代码来源:TorrentTypeColumn.php

示例12: init

 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Yii::$app->formatter->asShortSize($model->size);
         };
     }
 }
开发者ID:MaizerGomes,项目名称:openbay,代码行数:10,代码来源:TorrentSizeColumn.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->controller) {
         throw new InvalidConfigException("controller - " . \Yii::t('app', "not specified") . ".");
     }
     if (!$this->controller instanceof AdminModelEditorController) {
         throw new InvalidConfigException(\Yii::t('app', "{controller} must be inherited from") . ": " . AdminModelEditorController::className());
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:13,代码来源:ActionColumn.php

示例14: init

 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Yii::$app->formatter->asRelativeTime($model->created_at);
         };
     }
 }
开发者ID:MaizerGomes,项目名称:openbay,代码行数:10,代码来源:TorrentAgeColumn.php

示例15: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     // Set the filter options based on the info we have
     $this->filter = [$this->successValue => $this->successLabel, $this->dangerValue => $this->dangerLabel];
     $this->filterInputOptions = ['prompt' => $this->promptLabel, 'class' => 'form-control', 'id' => null];
     // Get the view
     $view = $this->grid->getView();
     ActiveCheckColumnAsset::register($view);
     return parent::init();
     // TODO: Change the autogenerated stub
 }
开发者ID:bvanleeuwen,项目名称:yii2-grid-check-column,代码行数:14,代码来源:CheckColumn.php


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