當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。