It provides features like sorting, paging and also filtering the data. For more details and usage information on BaseListView, see the guide article on data widgets.
Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\base\Widget
Exemplo n.º 1
0
 public function run()
 {
     $id = $this->options['id'];
     $options = Json::encode($this->getClientOptions());
     $view = $this->getView();
     InputGridAsset::register($view);
     $view->registerJs("jQuery('#{$id}').mdmInputGrid({$options});");
     \yii\widgets\BaseListView::run();
 }
Exemplo n.º 2
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->options['id'];
     $options = Json::htmlEncode($this->getClientOptions());
     $view = $this->getView();
     $view->registerJs("jQuery('#{$id}').yiiGridView({$options}).trigger('init');");
     if ($this->sectionLoad) {
         $view->registerJs("jQuery('#{$id}').on('click', '.pagination a, .sort a', function(event) {jQuery('{$this->sectionLoad}').load(this.href);event.stopImmediatePropagation();return false;});");
     }
     \yii\widgets\BaseListView::run();
 }
Exemplo n.º 3
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 = '';
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function renderSection($name)
 {
     switch ($name) {
         case "{errors}":
             return $this->renderErrors();
         default:
             return parent::renderSection($name);
     }
 }
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function renderSection($name)
 {
     switch ($name) {
         case '{errors}':
             return $this->renderErrors();
         case '{pager}':
             return $this->renderPager();
         default:
             return parent::renderSection($name);
     }
 }
Exemplo n.º 6
0
 public function run()
 {
     if ($this->runInConsoleMode == false) {
         GridViewAsset::register($this->getView());
         parent::run();
     } else {
         BaseListView::run();
     }
 }
Exemplo n.º 7
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $view = $this->getView();
     FilemanagerAsset::register($view);
     parent::run();
 }
Exemplo n.º 8
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->options['id'];
     $options = Json::encode($this->getClientOptions());
     $view = $this->getView();
     GridViewAsset::register($view);
     $view->registerJs("jQuery('#{$id}').yiiGridView({$options});");
     parent::run();
 }
Exemplo n.º 9
0
    /**
     * @inheritdoc
     */
    public function run()
    {
        Html::addCssClass($this->tableOptions, 'table');
        if ($this->hover) {
            Html::addCssClass($this->tableOptions, 'table-hover');
        }
        if ($this->bordered) {
            Html::addCssClass($this->tableOptions, 'table-bordered');
        }
        if ($this->striped) {
            Html::addCssClass($this->tableOptions, 'table-striped');
        }
        $this->initLayout();
        GridViewAsset::register($this->view);
        $options = Json::htmlEncode($this->getClientOptions());
        $this->view->registerJs("\$('#{$this->options['id']}').yiiGridView({$options});");
        if ($this->resizableColumns !== false) {
            $options = Json::htmlEncode($this->resizableColumnsOptions);
            $url = Url::toRoute($this->resizableColumnsUrl);
            $js = <<<JS
\$('#{$this->options['id']}').resizableColumns({$options}).on('afterDragging.rc', function(event) {
    var column = \$(this).closest('[data-resizable-column]'),
        data = {};
    data[column.data('resizable-column')] = column.outerWidth();
    \$.ajax({
        type: 'post',
        url: '{$url}',
        data: data
    });
});
JS;
            $this->view->registerJs($js);
        }
        BaseListView::run();
    }