yii\grid\GridView::run PHP Method

run() public method

Runs the widget.
public run ( )
    public function run()
    {
        $id = $this->options['id'];
        $options = Json::htmlEncode($this->getClientOptions());
        $view = $this->getView();
        GridViewAsset::register($view);
        $view->registerJs("jQuery('#{$id}').yiiGridView({$options});");
        parent::run();
    }

Usage Example

示例#1
1
    public function run(){

        if($this->is_pjax){
            Pjax::begin($this->pjaxOptions);
        }

        parent::run();

        if($this->isShowForm) {
            echo PageSize::widget([
                'model'     => $this->filterModel,
                'attribute' => $this->attribute,
                'options'   => [
                    'data-pjax' => '0',
                ],
            ]);
        }

        if($this->is_pjax){
            Pjax::end();
        }

        echo ModelCrud::widget([
            'size' => $this->modalSize,
            'updateUrl' => ($this->updateUrl)? $this->updateUrl : Url::to(['update']),
            'createUrl' => ($this->createUrl)? $this->createUrl : Url::to(['create']),
            'updateVerb' => 'post',
            'viewUrl' => Url::to(['view']),
            'viewVerb' => 'post',
            'createVerb' => 'post',
            'modelTitle' => $this->modelTitle,
            'template' => '{view}{update}{create}',
            'modelClass' =>  $this->dataProvider->query->modelClass
        ]);
    }
All Usage Examples Of yii\grid\GridView::run