init() public method

Initializes the view.
public init ( )
Esempio n. 1
0
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate [[columns]] objects.
  */
 public function init()
 {
     parent::init();
     $script = '';
     $view = $this->getView();
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     $opts = \yii\helpers\Json::encode(['viewFrom' => $this->viewFrom]);
     $script .= "\$('#{$this->options['id']}').filemanagerGallery({$opts});";
     $this->_galleryClientFunc = 'fmGalleryInit_' . hash('crc32', $script);
     $view->registerJs("var {$this->_galleryClientFunc}=function(){\n{$script}\n};\n{$this->_galleryClientFunc}();");
 }
Esempio n. 2
0
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate [[columns]] objects.
  */
 public function init()
 {
     parent::init();
     if ($this->formatter == null) {
         $this->formatter = Yii::$app->getFormatter();
     } elseif (is_array($this->formatter)) {
         $this->formatter = Yii::createObject($this->formatter);
     }
     if (!$this->formatter instanceof Formatter) {
         throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
     }
     $this->showOnEmpty = true;
     $this->emptyText = '<p>Currently Empty :(</p><p>Feel free to leave your comment!</p>';
     $this->summary = '';
 }
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate [[columns]] objects.
  */
 public function init()
 {
     parent::init();
     if ($this->formatter == null) {
         $this->formatter = Yii::$app->getFormatter();
     } elseif (is_array($this->formatter)) {
         $this->formatter = Yii::createObject($this->formatter);
     }
     if (!$this->formatter instanceof Formatter) {
         throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
     }
     if (!isset($this->filterRowOptions['id'])) {
         $this->filterRowOptions['id'] = $this->options['id'] . '-filters';
     }
     $this->initColumns();
 }