init() public method

This method will initialize required property values and instantiate [[columns]] objects.
public init ( )
Beispiel #1
0
 /**
  * Inits widget
  */
 public function init()
 {
     parent::init();
     $this->initVisible();
     $this->initSortable();
     //GridViewAsset::register($this->view);
 }
Beispiel #2
0
 public function init()
 {
     parent::init();
     if (!$this->options['ajax']) {
         echo '<div id="box-' . $this->id . '" class="box box-primary">' . '  <div class="box-header with-border">';
         if (isset($this->options['boxTitle'])) {
             echo Html::tag('h3', '<i class="fa fa-list"></i> ' . $this->options['boxTitle'], ['class' => 'box-title']);
         }
         echo '<div class="box-tools pull-right">';
         if (isset($this->options['buttonUp'])) {
             echo Html::a('<i class="fa fa-arrow-up"></i>', $this->options['buttonUp'], ['id' => 'button-up', 'class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Up')]);
             echo ' ';
         }
         if (isset($this->options['buttonCreate'])) {
             echo Html::a('<i class="fa fa-plus"></i>', $this->options['buttonCreate'], ['class' => 'btn btn-sm btn-primary', 'title' => \Yii::t('theme/widgets/box', 'Create')]);
             echo ' ';
         }
         if (isset($this->options['buttonDelete'])) {
             echo Html::a('<i class="fa fa-trash-o"></i>', $this->options['buttonDelete'], ['id' => 'batch-delete', 'class' => 'btn btn-sm btn-danger', 'title' => \Yii::t('theme/widgets/box', 'Delete')]);
             echo ' ';
         }
         if (isset($this->options['buttonUndo'])) {
             echo Html::a('<i class="fa fa-undo"></i>', $this->options['buttonUndo'], ['class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Undo')]);
             echo ' ';
         }
         echo '</div>';
         echo '</div>';
         echo '<div class="box-body">';
         $this->renderFiltersForm();
     }
     echo "<div id='table-{$this->id}'>";
 }
Beispiel #3
0
 public function init()
 {
     parent::init();
     $this->emptyText = Html::t('templete', 'noData');
     $this->summary = Html::t('templete', 'summary');
     $this->getView()->registerCssFile('/css/listStyle.css');
 }
Beispiel #4
0
 public function init()
 {
     parent::init();
     if ($this->ajaxPager) {
         $this->pager['targetId'] = $this->id;
     }
 }
Beispiel #5
0
 public function init()
 {
     $this->tableOptions = ['class' => 'table ' . $this->type];
     $this->dataProvider = new ArrayDataProvider(['allModels' => $this->data, 'pagination' => false]);
     $this->layout = '{items}';
     parent::init();
 }
 public function init()
 {
     $this->showHeader = false;
     $this->showFooter = false;
     $this->layout = '{items}';
     $this->columns = [['class' => 'yii\\grid\\DataColumn', 'format' => 'raw', 'value' => function ($post) {
         foreach ($post->postDates as $postDate) {
             if (!isset($first)) {
                 $first = $postDate->PostDate;
             }
             $last = $postDate->PostDate;
         }
         if ($first == $last) {
             $value = $first;
         } else {
             $value = $first . ' &mdash; ' . $last;
         }
         if ($post->PostText) {
             $value = $value . '<br />' . $post->PostText;
         }
         return $value;
     }], ['format' => 'raw', 'value' => function ($post) {
         return '<span class="js-past_vacation_delete grid_delete_icon" data-post-id="' . $post->PostID . '"><i class="fa fa-trash"></i></span>';
     }]];
     parent::init();
 }
Beispiel #7
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->columns)) {
         $this->columns = $this->columns();
     }
     $this->columns = array_merge($this->columns, $this->actions());
     parent::init();
 }
 public function init()
 {
     if ($this->sortableColumn) {
         array_unshift($this->columns, ['class' => 'twixoff\\sortablegrid\\SortableColumn']);
     }
     $this->sortableAction = Url::to($this->sortableAction);
     parent::init();
 }
 /**
  * Initializes the grid view.
  * This method will initialize required property values and instantiate [[columns]] objects.
  */
 public function init()
 {
     $this->dataColumnClass = DataColumn::className();
     $this->summaryOptions = ['class' => 'summary well well-sm pull-left margin-bottom-10px'];
     $this->layout = '{summary}<div class="clearfix"></div>{pager}{items}{pager}';
     $this->showFooter = true;
     $this->options = ArrayHelper::merge($this->options, ['class' => 'grid-view table-responsive']);
     $this->pager = ['class' => LinkPager::className()];
     parent::init();
 }
Beispiel #10
0
 public function init()
 {
     parent::init();
     $this->tableOptions['layoutH'] = $this->layoutH;
     $this->layout = "<div id='w_list_print'>{summary}\n{items}\n{pager}</div>";
     $this->options['class'] = 'pageContent';
     $pagination = new Pagination();
     $this->dataProvider->setPagination($pagination);
     $this->dataProvider->setSort(new Sort());
 }
Beispiel #11
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->columns)) {
         $this->columns = $this->columns();
     }
     if (!isset($this->columns['actions'])) {
         $this->columns['actions'] = ['class' => 'asdfstudio\\admin\\grids\\ActionColumn'];
     }
     parent::init();
 }
Beispiel #12
0
 public function init()
 {
     if ($this->modelClass === null) {
         $models = $this->dataProvider->getModels();
         if (($model = reset($models)) instanceof Model) {
             $this->modelClass = $model->classname();
         }
     }
     parent::init();
 }
Beispiel #13
0
 public function init()
 {
     parent::init();
     $this->rowOptions = function ($model, $key, $index, $grid) {
         if ($index % 2 === 0) {
             return ['class' => 'odd'];
         } else {
             return ['class' => 'even'];
         }
     };
 }
Beispiel #14
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->actions) {
         $column = ['class' => 'app\\base\\grid\\ActionColumn', 'header' => 'Actions'];
         if (is_array($this->actions)) {
             $column['buttons'] = $this->actions;
         }
         $this->columns[] = $column;
     }
     parent::init();
     $this->initDefaultToolButtons();
 }
 public function init()
 {
     parent::init();
     if (!isset($this->sortUrl)) {
         throw new InvalidConfigException("You must specify the sortUrl");
     }
     GridViewAsset::register($this->view);
     SortableGridViewAsset::register($this->view);
     $this->tableOptions['class'] .= ' sortable-grid-view';
     $this->rowOptions = function ($model, $key, $index, $grid) {
         return ['id' => "items[]_{$model->primaryKey}"];
     };
 }
Beispiel #16
0
 public function init()
 {
     $this->registerPlugin();
     if (!empty($this->aligned)) {
         UI::addCssClasses($this->rowOptions, [$this->aligned, 'aligned']);
         UI::addCssClasses($this->headerRowOptions, [$this->aligned, 'aligned']);
         UI::addCssClasses($this->footerRowOptions, [$this->aligned, 'aligned']);
     }
     $this->pager['class'] = '\\vx\\Semantic\\Widget\\LinkPager';
     $this->sorter['class'] = '\\vx\\Semantic\\Widget\\LinkSorter';
     $this->dataColumnClass = 'vx\\Semantic\\Widget\\DataColumn';
     $this->initOption();
     parent::init();
 }
Beispiel #17
0
 public function init()
 {
     $this->columns = ['id', 'pid', 'window.process.screenName:text:Process', 'window.title', 'formattedDuration:text:Duration', 'motions', 'clicks', 'scrolls', 'keys', ['attribute' => 'tasks', 'content' => function ($model, $key, $index, $column) {
         $tasks = [];
         foreach ($model->tasks as $task) {
             $tasks[] = "<span class='badge'>{$task->name}</span>";
         }
         return implode("\n", $tasks);
     }], ['attribute' => 'created', 'content' => function ($model) {
         $timestamp = new \DateTime($model->created, new \DateTimeZone('UTC'));
         $timestamp->setTimezone(new \DateTimeZone(Yii::$app->timeZone));
         return $timestamp->format('Y-m-d H:i:s');
     }], ['class' => 'yii\\grid\\ActionColumn']];
     parent::init();
 }
Beispiel #18
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->bordered) {
         Html::addCssClass($this->tableOptions, 'table-bordered');
     }
     if ($this->condensed) {
         Html::addCssClass($this->tableOptions, 'table-condensed');
     }
     if ($this->striped) {
         Html::addCssClass($this->tableOptions, 'table-striped');
     }
     if ($this->hover) {
         Html::addCssClass($this->tableOptions, 'table-hover');
     }
     parent::init();
 }
Beispiel #19
0
 /**
  * Initializes the datatables widget disabling some GridView options like 
  * search, sort and pagination and using DataTables JS functionalities 
  * instead.
  */
 public function init()
 {
     parent::init();
     //disable filter model by grid view
     $this->filterModel = null;
     //disable sort by grid view
     $this->dataProvider->sort = false;
     //disable pagination by grid view
     $this->dataProvider->pagination = false;
     //layout showing only items
     $this->layout = "{items}";
     //the table id must be set
     if (!isset($this->tableOptions['id'])) {
         $this->tableOptions['id'] = 'datatables_' . $this->getId();
     }
 }
Beispiel #20
0
    public function init()
    {

        $this->rowOptions = function ($model, $key, $index, $grid) {

            $class = $index % 2 ? 'info' : '';
            return array('key' => $key, 'index' => $index, 'class' => $class);

        };

        if ($this->isShowForm) {
            $this->filterSelector = 'select[name="' . StringHelper::basename(get_class($this->filterModel)) . '[pageSize]"]';
        }


        parent::init();

    }
 public function init()
 {
     parent::init();
     $classes = isset($this->options['class']) ? $this->options['class'] : '';
     $classes .= ' sortable';
     $this->options['class'] = trim($classes);
     $view = $this->getView();
     JuiAsset::register($view);
     $url = Url::toRoute($this->orderUrl);
     $sortOpts = array_merge($this->sortOptions, ['helper' => new JsExpression('function(e, ui) {
             ui.children().each(function() {
                $(this).width($(this).width());
             });
             return ui;
         }'), 'update' => new JsExpression("function(e, ui) {\n                jQuery('#{$this->id}').addClass('sorting');\n                jQuery.ajax({\n                    type: 'POST',\n                    url: '{$url}',\n                    data: {\n                        key: ui.item.data('key'),\n                        pos: ui.item.index()\n                    },\n                    complete: function() {\n                        jQuery('#{$this->id}').removeClass('sorting');\n                    }\n                });\n            }")]);
     if ($this->sortAxis) {
         $sortOpts['axis'] = $this->sortAxis;
     }
     $sortJson = Json::encode($sortOpts);
     $id = $this->getId();
     $view->registerJs("jQuery('#{$id} tbody').sortable({$sortJson});");
 }
Beispiel #22
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->_module = Config::initModule(Module::classname());
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (!$this->toggleData) {
         parent::init();
         return;
     }
     $this->_toggleDataKey = '_tog' . hash('crc32', $this->options['id']);
     $this->_isShowAll = ArrayHelper::getValue($_GET, $this->_toggleDataKey, 'page') === 'all';
     if ($this->_isShowAll) {
         $this->dataProvider->pagination = false;
     }
     parent::init();
 }
Beispiel #23
0
 public function init()
 {
     $this->initPlugins();
     parent::init();
     $this->trigger(self::EVENT_AFTER_INIT);
 }
Beispiel #24
0
 public function init()
 {
     parent::init();
     $this->pjaxClassName = Pjax::className();
 }
Beispiel #25
0
 public function init()
 {
     parent::init();
     $this->initVisible();
     $this->initSortable();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     FoundationIconAsset::register($this->getView());
 }
 public function init()
 {
     $this->dataColumnClass = EditorDataColumn::className();
     parent::init();
 }
Beispiel #28
0
 public function init()
 {
     return parent::init();
 }
Beispiel #29
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->_module = Config::initModule(Module::classname());
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (!$this->toggleData) {
         parent::init();
         return;
     }
     $this->_toggleDataKey = '_tog' . hash('crc32', $this->options['id']);
     $this->_isShowAll = ArrayHelper::getValue($_GET, $this->_toggleDataKey, $this->defaultPagination) === 'all';
     if ($this->_isShowAll) {
         /** @noinspection PhpUndefinedFieldInspection */
         $this->dataProvider->pagination = false;
     }
     $this->_toggleButtonId = $this->options['id'] . '-togdata-' . ($this->_isShowAll ? 'all' : 'page');
     parent::init();
 }
Beispiel #30
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $config = $this->_initConfig();
     //Setup dataprovider
     $this->dataProvider = (new LanguageSearch())->search($config);
     if (empty($this->rowOptions)) {
         $this->rowOptions = function ($model, $key, $index, $grid) {
             return ['class' => $model['status'] == -1 ? 'danger' : ($model['status'] == 1 ? 'info' : 'active')];
         };
     }
     //Parse widget template configuration string in to an array
     $this->_template = TemplateHelper::explode($this->template);
     //Run parent Gridview initialisation invokes overwritten initColumns method
     parent::init();
 }