init() public method

public init ( )
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
     $this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
     if ($this->refreshGrid) {
         EditableColumnAsset::register($this->_view);
     }
 }
Example #2
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     \kartik\base\Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
     $this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
     if ($this->refreshGrid) {
         EditableColumnAsset::register($this->_view);
         $id = $this->grid->options['id'];
         $this->_view->registerJs("kvRefreshEC('{$id}','{$this->_css}');");
     }
 }
Example #3
0
 public function init()
 {
     if (empty($this->trueLabel)) {
         $this->trueLabel = Yii::t('kvgrid', 'Active');
     }
     if (empty($this->falseLabel)) {
         $this->falseLabel = Yii::t('kvgrid', 'Inactive');
     }
     $this->filter = [true => $this->trueLabel, false => $this->falseLabel];
     if (empty($this->trueIcon)) {
         $this->trueIcon = $this->grid->bootstrap ? GridView::ICON_ACTIVE : $this->trueLabel;
     }
     if (empty($this->falseIcon)) {
         $this->falseIcon = $this->grid->bootstrap ? GridView::ICON_INACTIVE : $this->falseIcon;
     }
     parent::init();
 }
Example #4
0
 public function init()
 {
     Icon::map($this->grid->getView());
     $this->registerTranslations();
     parent::init();
     // TODO: Change the autogenerated stub
     $this->value = function ($model, $key, $index, $widget) {
         $lockIcon = '';
         if ($this->showLock) {
             if ($model->hasAttribute('locked') && $model->{$model->lockedAttribute}) {
                 $lockIcon = Icon::show('eye-slash');
             } else {
                 $lockIcon = Icon::show('eye');
             }
         }
         return Html::a($lockIcon . $model->{$this->attribute}, ['update', 'id' => $model->id], ['title' => self::t('messages', 'Edit item')]);
     };
 }
Example #5
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     \kartik\base\Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
     $this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->detail) && empty($this->detailUrl)) {
         throw new InvalidConfigException("Either the 'detail' or 'detailUrl' must be entered");
     }
     $this->format = 'raw';
     $this->expandIcon = $this->getIcon('expand');
     $this->collapseIcon = $this->getIcon('collapse');
     $this->setProp('expandTitle', Yii::t('kvgrid', 'Expand'));
     $this->setProp('collapseTitle', Yii::t('kvgrid', 'Collapse'));
     $this->setProp('expandAllTitle', Yii::t('kvgrid', 'Expand All'));
     $this->setProp('collapseAllTitle', Yii::t('kvgrid', 'Collapse All'));
     $onDetailLoaded = $this->onDetailLoaded;
     if (!empty($onDetailLoaded) && !$onDetailLoaded instanceof JsExpression) {
         $onDetailLoaded = new JsExpression($onDetailLoaded);
     }
     if ($this->allowBatchToggle) {
         $this->headerOptions['title'] = $this->expandAllTitle;
     }
     if ($this->allowBatchToggle && $this->defaultHeaderState === GridView::ROW_EXPANDED) {
         $this->headerOptions['title'] = $this->collapseTitle;
     }
     $class = 'kv-expand-header-cell';
     $class .= $this->allowBatchToggle ? ' kv-batch-toggle' : ' text-muted';
     Html::addCssClass($this->headerOptions, $class);
     $view = $this->grid->getView();
     ExpandRowColumnAsset::register($view);
     $clientOptions = Json::encode(['gridId' => $this->grid->options['id'], 'hiddenFromExport' => $this->hiddenFromExport, 'detailUrl' => empty($this->detailUrl) ? '' : $this->detailUrl, 'onDetailLoaded' => $onDetailLoaded, 'expandIcon' => $this->expandIcon, 'collapseIcon' => $this->collapseIcon, 'expandTitle' => $this->expandTitle, 'collapseTitle' => $this->collapseTitle, 'expandAllTitle' => $this->expandAllTitle, 'collapseAllTitle' => $this->collapseAllTitle, 'rowCssClass' => $this->detailRowCssClass, 'animationDuration' => $this->detailAnimationDuration, 'expandOneOnly' => $this->expandOneOnly, 'enableRowClick' => $this->enableRowClick, 'enableCache' => $this->enableCache, 'rowClickExcludedTags' => array_map('strtoupper', $this->rowClickExcludedTags), 'collapseAll' => false, 'expandAll' => false, 'extraData' => $this->extraData]);
     $this->_hashVar = 'kvExpandRow_' . hash('crc32', $clientOptions);
     $view->registerJs("var {$this->_hashVar} = {$clientOptions};\n", View::POS_HEAD);
     $view->registerJs("kvExpandRow({$this->_hashVar});");
 }
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     \kartik\base\Config::checkDependency('editable\Editable', 'yii2-editable', 'for GridView EditableColumn');
 }