yii\widgets\BaseListView::init PHP Method

init() public method

Initializes the view.
public init ( )
    public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set.');
        }
        if ($this->emptyText === null) {
            $this->emptyText = Yii::t('yii', 'No results found.');
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
    }

Usage Example

 /**
  * 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}();");
 }
All Usage Examples Of yii\widgets\BaseListView::init