コード例 #1
0
ファイル: SnapGridView.php プロジェクト: snapfrozen/snapcms
 public function init()
 {
     $this->setFormatter(new SnapFormatter());
     parent::init();
     $this->snapBaseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('snapcms.widgets.assets')) . '/snapgridview';
     if ($this->selectableColumns === true) {
         $cs = Yii::app()->getClientScript();
         $cs->registerScriptFile($this->snapBaseScriptUrl . '/jquery.snapgridview.js', CClientScript::POS_END);
         $cs->registerCssFile($this->snapBaseScriptUrl . '/styles.css');
         if (empty($this->afterAjaxUpdate)) {
             $this->afterAjaxUpdate = "\$.fn.snapGridView.init";
         }
         $this->_setSelectedColumns();
         foreach ($this->columns as $pos => $column) {
             if (is_subclass_of($column, 'CDataColumn')) {
                 //populate the _selectableColumnsList used for generating checkboxes
                 $this->_selectableColumnsList[$column->name] = $column->header ? $column->header : $this->dataProvider->model->getAttributeLabel($column->name);
                 //remove any columns that arent' selected
                 if (!in_array($column->name, $this->selectedColumns)) {
                     unset($this->columns[$pos]);
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: BootSelGridView.php プロジェクト: postfx/fermion
 public function init()
 {
     if ($this->selectableRows > 0) {
         //generate name of variable for selection from request
         if (empty($this->selVar)) {
             $id = $this->dataProvider->getId();
             if (empty($id)) {
                 $id = $this->id;
             }
             $this->selVar = empty($id) ? 'sel' : $id . '_sel';
         }
         //publish required assets
         if ($this->selBaseScriptUrl === null) {
             $this->selBaseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.selgridview.assets'));
         }
     }
     parent::init();
 }