当前位置: 首页>>代码示例>>PHP>>正文


PHP GridView::init方法代码示例

本文整理汇总了PHP中kartik\grid\GridView::init方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::init方法的具体用法?PHP GridView::init怎么用?PHP GridView::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kartik\grid\GridView的用法示例。


在下文中一共展示了GridView::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     parent::init();
     if ($this->nestable === true || is_array($this->nestable)) {
         echo $this->nestableGrid();
     }
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:7,代码来源:GridView.php

示例2: init

 public function init()
 {
     if (!is_null($this->gridHookName)) {
         $this->getHookData();
     }
     parent::init();
 }
开发者ID:AtuinCMS,项目名称:engine,代码行数:7,代码来源:GridView.php

示例3: init

 function init()
 {
     parent::init();
     if (!isset($this->replaceTags['{fullExport}'])) {
         $this->replaceTags['{fullExport}'] = ExcelMenu::widget(['dataProvider' => $this->dataProvider, 'filterModel' => $this->filterModel, 'columns' => $this->_columns, 'asDropdown' => $this->asButtonDropdown, 'exportConfig' => $this->exportMenu, 'showConfirmAlert' => false, 'target' => ExportMenu::TARGET_BLANK, 'filename' => $this->filename ?: $this->view->title ?: 'grid-export', 'enableFormatter' => false]);
     }
 }
开发者ID:sateler,项目名称:yii2-excelview,代码行数:7,代码来源:ExcelView.php

示例4: init

 /**
  * Inits widget
  */
 public function init()
 {
     parent::init();
     $this->initPager();
     $this->initVisible();
     $this->initSortable();
     //GridViewAsset::register($this->view);
 }
开发者ID:wfcreations,项目名称:yii2-metronic,代码行数:11,代码来源:GridView.php

示例5: init

 /**
  * (non-PHPdoc)
  * @see \kartik\grid\GridView::init()
  */
 public function init()
 {
     if (!isset($this->templateName)) {
         throw InvalidConfigException("Property tamplateName need to be set.");
     }
     $this->template_name = $this->templateName;
     $this->initTemplate();
     $this->prepareColumns();
     $this->prepareToolBar();
     $this->pjax = true;
     $this->pjaxSettings['options'] = ['id' => 'flexible-grid-pjax'];
     parent::init();
     $this->_module = Config::initModule(Module::classname());
 }
开发者ID:novikas,项目名称:yii2-flexform,代码行数:18,代码来源:FlexibleGrid.php

示例6: 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, ['axis' => 'y', '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            }")]);
     $sortJson = Json::encode($sortOpts);
     $id = $this->getId();
     $view->registerJs("var id = {$id}; var sortJson = {$sortJson}; jQuery('#{$id} tbody').sortable({$sortJson});");
 }
开发者ID:infoweb-internet-solutions,项目名称:yii2-sortable-behavior,代码行数:19,代码来源:SortableGridView.php

示例7: init

 public function init()
 {
     $this->registerTranslations();
     //Toolbar
     $toolbar = ['{export}', '{toggleData}'];
     $view = $this->getView();
     $basic_toolbar = [['content' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . self::t('toolbar', 'Add'), ['update'], ['data-pjax' => 0, 'title' => 'Add Pages', 'class' => 'btn btn-success']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . self::t('toolbar', 'Refresh'), ['index'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => 'Reset Grid'])]];
     if ($this->filterModel->hasAttribute('category_id') || $this->filterModel->hasMethod('getCategory')) {
         array_push($basic_toolbar, ['content' => Html::a('<i class="glyphicon glyphicon-list"></i> ' . self::t('toolbar', 'Categories'), [\Yii::$app->controller->id . '-category/list'], ['data-pjax' => 0, 'title' => 'Categories', 'class' => 'btn btn-default'])]);
     }
     if ($this->filterModel->hasAttribute($this->filterModel->removedAttribute)) {
         array_push($basic_toolbar, ['content' => Html::a('<i class="glyphicon glyphicon-trash"></i> ' . self::t('toolbar', 'In Trash'), ['trash'], ['data-pjax' => 0, 'title' => 'Removed records', 'class' => 'btn btn-default'])]);
     }
     if ($view->context->action->id === 'trash') {
         $basic_toolbar = [['content' => Html::a('<i class="glyphicon glyphicon-arrow-left"></i> ' . self::t('toolbar', 'Back to Records'), ['list'], ['data-pjax' => 0, 'title' => 'List records', 'class' => 'btn btn-default'])]];
     }
     $toolbar = \yii\helpers\ArrayHelper::merge($basic_toolbar, $toolbar);
     $this->toolbar = $toolbar;
     return parent::init();
     // TODO: Change the autogenerated stub
 }
开发者ID:sibds,项目名称:yii2-gridhelper,代码行数:21,代码来源:GridView.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (empty($this->exportRequestParam)) {
         $this->exportRequestParam = 'exportFull_' . $this->options['id'];
     }
     $this->_columnSelectorEnabled = $this->showColumnSelector && $this->asDropdown;
     $this->_triggerDownload = !empty($_POST) && !empty($_POST[$this->exportRequestParam]) && $_POST[$this->exportRequestParam];
     $this->_doNotStream = !$this->stream && !$this->streamAfterSave;
     if ($this->_doNotStream) {
         $this->target = self::TARGET_SELF;
     }
     if ($this->_triggerDownload) {
         if (!$this->_doNotStream) {
             Yii::$app->controller->layout = false;
         }
         $this->_exportType = $_POST[self::PARAM_EXPORT_TYPE];
         $this->_columnSelectorEnabled = $_POST[self::PARAM_COLSEL_FLAG];
         $this->initSelectedColumns();
     }
     parent::init();
 }
开发者ID:e0725675,项目名称:yii2-export,代码行数:27,代码来源:ExportMenu.php

示例9: init

 public function init()
 {
     return parent::init();
 }
开发者ID:letyii,项目名称:cms,代码行数:4,代码来源:GridView.php

示例10: init

 public function init()
 {
     Yii::setAlias('@excelview', dirname(__FILE__));
     Yii::$app->i18n->translations['excelview'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@excelview/messages', 'forceTranslation' => true];
     if ($this->fullExport !== false) {
         $this->fullExport = ArrayHelper::merge(['label' => Yii::t('excelview', 'Full Export'), 'icon' => 'export', 'browserPopupsMsg' => Yii::t('excelview', 'Disable any popup blockers in your browser to ensure proper download.'), 'options' => ['class' => 'btn btn-danger']], $this->export);
         $defaultExportConfig = [self::FULL_HTML => ['label' => Yii::t('excelview', 'HTML'), 'icon' => 'floppy-saved', 'filename' => Yii::t('excelview', 'grid-export'), 'options' => ['title' => Yii::t('excelview', 'Save as HTML')], 'Content-type' => 'text/html', 'extension' => 'html', 'PHPExcel_Writer' => 'HTML', 'header' => true], self::FULL_CSV => ['label' => Yii::t('excelview', 'CSV'), 'icon' => 'floppy-open', 'colDelimiter' => ",", 'rowDelimiter' => "\r\n", 'filename' => Yii::t('excelview', 'grid-export'), 'options' => ['title' => Yii::t('excelview', 'Save as CSV')], 'Content-type' => 'application/csv', 'extension' => 'csv', 'PHPExcel_Writer' => 'CSV', 'header' => false], self::FULL_PDF => ['label' => Yii::t('excelview', 'PDF'), 'icon' => 'floppy-save', 'filename' => Yii::t('excelview', 'grid-export'), 'options' => ['title' => Yii::t('excelview', 'Save as PDF')], 'Content-type' => 'application/pdf', 'extension' => 'pdf', 'PHPExcel_Writer' => 'PDF', 'header' => true], self::FULL_EXCEL => ['label' => Yii::t('excelview', 'Excel 95 and above'), 'icon' => 'floppy-remove', 'worksheet' => Yii::t('excelview', 'ExportWorksheet'), 'filename' => Yii::t('excelview', 'grid-export'), 'cssFile' => '', 'options' => ['title' => Yii::t('excelview', 'Save as Excel (xls)')], 'Content-type' => 'application/vnd.ms-excel', 'extension' => 'xls', 'PHPExcel_Writer' => 'Excel5', 'header' => true], self::FULL_EXCELX => ['label' => Yii::t('excelview', 'Excel 2007 and above'), 'icon' => 'floppy-remove', 'worksheet' => Yii::t('excelview', 'ExportWorksheet'), 'filename' => Yii::t('excelview', 'grid-export'), 'cssFile' => '', 'options' => ['title' => Yii::t('excelview', 'Save as Excel (xlsx)')], 'Content-type' => 'application/vnd.ms-excel', 'extension' => 'xlsx', 'PHPExcel_Writer' => 'Excel2007', 'header' => true]];
         if (is_array($this->fullExportConfig) && !empty($this->fullExportConfig)) {
             foreach ($this->fullExportConfig as $format => $setting) {
                 $setup = is_array($this->fullExportConfig[$format]) ? $this->fullExportConfig[$format] : [];
                 $exportConfig[$format] = empty($setup) ? $defaultExportConfig[$format] : ArrayHelper::merge($defaultExportConfig[$format], $setup);
             }
             $this->fullExportConfig = $exportConfig;
         } else {
             $this->fullExportConfig = $defaultExportConfig;
         }
         foreach ($this->fullExportConfig as $format => $setting) {
             $this->fullExportConfig[$format]['options']['data-pjax'] = false;
         }
     }
     $params = \Yii::$app->request->queryParams;
     if (isset($params[$this->grid_mode_var])) {
         $this->grid_mode = $params[$this->grid_mode_var];
     }
     if (isset($params['exportType'])) {
         $this->fullExportType = $params['exportType'];
     }
     if ($this->grid_mode == 'export') {
         #$this->title = $this->title ? $this->title : \yii\web\View::$title;
         $module = Yii::$app->getModule('gridview');
         $this->initColumns();
         //parent::init();
         //Autoload fix
         #            spl_autoload_unregister(array('YiiBase', 'autoload'));
         #            Yii::import($this->libPath, true);
         $this->objPHPExcel = new \PHPExcel();
         #            spl_autoload_register(array('YiiBase', 'autoload'));
         // Creating a workbook
         $this->objPHPExcel->getProperties()->setCreator($this->creator);
         $this->objPHPExcel->getProperties()->setTitle($this->title);
         $this->objPHPExcel->getProperties()->setSubject($this->subject);
         $this->objPHPExcel->getProperties()->setDescription($this->description);
         $this->objPHPExcel->getProperties()->setCategory($this->category);
     } else {
         parent::init();
     }
 }
开发者ID:Bladefidz,项目名称:ocfa_yii,代码行数:47,代码来源:ExcelView.php

示例11: init

 public function init()
 {
     parent::init();
 }
开发者ID:nagser,项目名称:base,代码行数:4,代码来源:GridView.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->_columnSelectorEnabled = $this->showColumnSelector && $this->asDropdown;
     $this->_triggerDownload = !empty($_POST) && !empty($_POST[$this->exportRequestParam]) && $_POST[$this->exportRequestParam];
     if ($this->_triggerDownload) {
         Yii::$app->controller->layout = false;
         $this->_exportType = $_POST[self::PARAM_EXPORT_TYPE];
         $this->_columnSelectorEnabled = $_POST[self::PARAM_COLSEL_FLAG];
         $this->initSelectedColumns();
     }
     parent::init();
 }
开发者ID:yuinakorn,项目名称:hhj,代码行数:15,代码来源:ExportMenu.php

示例13: init

 public function init()
 {
     $module = Yii::$app->getModule('gridview');
     if ($module == null || !$module instanceof \kartik\grid\Module) {
         throw new InvalidConfigException('The "gridview" module MUST be setup in your Yii configuration file and assigned to "\\kartik\\grid\\Module" class.');
     }
     if ($this->export !== false) {
         $this->export = ArrayHelper::merge(['label' => Yii::t('kvgrid', 'Export'), 'icon' => 'export', 'browserPopupsMsg' => Yii::t('kvgrid', 'Disable any popup blockers in your browser to ensure proper download.'), 'options' => ['class' => 'btn btn-danger']], $this->export);
         $defaultExportConfig = [self::HTML => ['label' => Yii::t('kvgrid', 'HTML'), 'icon' => 'floppy-saved', 'showHeader' => true, 'showPageSummary' => true, 'showFooter' => true, 'showCaption' => true, 'filename' => Yii::t('kvgrid', 'grid-export'), 'alertMsg' => Yii::t('kvgrid', 'The HTML export file will be generated for download.'), 'cssFile' => 'http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css', 'options' => ['title' => Yii::t('kvgrid', 'Save as HTML')]], self::CSV => ['label' => Yii::t('kvgrid', 'CSV'), 'icon' => 'floppy-open', 'showHeader' => true, 'showPageSummary' => true, 'showFooter' => true, 'showCaption' => true, 'colDelimiter' => ",", 'rowDelimiter' => "\r\n", 'filename' => Yii::t('kvgrid', 'grid-export'), 'alertMsg' => Yii::t('kvgrid', 'The CSV export file will be generated for download.'), 'options' => ['title' => Yii::t('kvgrid', 'Save as CSV')]], self::TEXT => ['label' => Yii::t('kvgrid', 'Text'), 'icon' => 'floppy-save', 'showHeader' => true, 'showPageSummary' => true, 'showFooter' => true, 'showCaption' => true, 'colDelimiter' => "\t", 'rowDelimiter' => "\r\n", 'filename' => Yii::t('kvgrid', 'grid-export'), 'alertMsg' => Yii::t('kvgrid', 'The TEXT export file will be generated for download.'), 'options' => ['title' => Yii::t('kvgrid', 'Save as Text')]], self::EXCEL => ['label' => Yii::t('kvgrid', 'Excel'), 'icon' => 'floppy-remove', 'showHeader' => true, 'showPageSummary' => true, 'showFooter' => true, 'showCaption' => true, 'worksheet' => Yii::t('kvgrid', 'ExportWorksheet'), 'filename' => Yii::t('kvgrid', 'grid-export'), 'alertMsg' => Yii::t('kvgrid', 'The EXCEL export file will be generated for download.'), 'cssFile' => '', 'options' => ['title' => Yii::t('kvgrid', 'Save as Excel')]]];
         $exportConfig = [];
         if (is_array($this->exportConfig) && !empty($this->exportConfig)) {
             foreach ($this->exportConfig as $format => $setting) {
                 $setup = is_array($this->exportConfig[$format]) ? $this->exportConfig[$format] : [];
                 $exportConfig[$format] = empty($setup) ? $defaultExportConfig[$format] : ArrayHelper::merge($defaultExportConfig[$format], $setup);
             }
             $this->exportConfig = $exportConfig;
         } else {
             $this->exportConfig = $defaultExportConfig;
         }
     }
     if ($this->filterPosition === self::FILTER_POS_HEADER) {
         // Float header plugin misbehaves when Filter is placed on the first row
         // So disable it when `filterPosition` is `header`.
         $this->floatHeader = false;
     }
     if ($this->bootstrap) {
         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');
         }
         if ($this->condensed) {
             Html::addCssClass($this->tableOptions, 'table-condensed');
         }
     }
     parent::init();
     $this->registerAssets();
 }
开发者ID:pipekung,项目名称:yii2-grid,代码行数:43,代码来源:GridView.php

示例14: init

 public function init()
 {
     if ($this->panel) {
         $this->bordered = false;
         $this->condensed == true;
         $this->presetPanelIcon();
     }
     if ($this->resizableColumns && $this->persistResize) {
         // set the default resizeStorageKey
         $this->resizeStorageKey = Yii::$app->user->id . '-' . date("m");
     }
     // enable first and last pager button
     $this->pager = ['prevPageLabel' => '&lt;', 'nextPageLabel' => '&gt;', 'firstPageLabel' => '<< First', 'lastPageLabel' => 'Last >>'];
     /*
     $this->toolbar = [
         ['content'=>
             Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type'=>'button', 'title'=>Yii::t('kvgrid', 'Add Book'), 'class'=>'btn btn-success', 'onclick'=>'alert("This will launch the book creation form.\n\nDisabled for this demo!");']) . ' '.
             Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], ['data-pjax'=>0, 'class' => 'btn btn-default', 'title'=>Yii::t('kvgrid', 'Reset Grid')])
         ],
         '{export}',
         '{toggleData}',
     ];
     */
     parent::init();
     $this->export = ArrayHelper::merge(['label' => Yii::t('kvgrid', 'Export'), 'icon' => 'export', 'browserPopupsMsg' => Yii::t('kvgrid', 'Disable any popup blockers in your browser to ensure proper download.'), 'options' => ['class' => 'btn btn-danger']], $this->export);
 }
开发者ID:EuresTools,项目名称:eVote-web,代码行数:26,代码来源:GridView.php

示例15: init

 public function init()
 {
     parent::init();
     $this->sortableAction = Url::to($this->sortableAction);
 }
开发者ID:octoweb,项目名称:yii2-grid-view-sort,代码行数:5,代码来源:SortableGridView.php


注:本文中的kartik\grid\GridView::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。