コード例 #1
0
 public function init()
 {
     if (!$this->name) {
         throw new CException('You should provide name for TbEditableColumn');
     }
     parent::init();
     /**
      * add a dummy object to the data provider and call render function to allow register 
      * required scripts if grid was initially empty...
      */
     if (empty($this->grid->dataProvider->data)) {
         if ($this->grid->dataProvider instanceof CActiveDataProvider) {
             $dummy = new $this->grid->dataProvider->modelClass();
         } else {
             if ($this->grid->dataProvider instanceof CArrayDataProvider) {
                 $keys = $this->fetchKeys($this->grid->dataProvider);
                 $dummy = array();
                 foreach ($keys as $key) {
                     $dummy[$key] = $key;
                     // anyvalue;
                 }
             } else {
                 $dummy = null;
             }
         }
         $this->grid->dataProvider->data = array($dummy);
         $this->editable['htmlOptions'] = array('style' => 'display: none;');
         $this->renderDataCellContent(0, $dummy);
         // this is the target line
         $this->grid->dataProvider->data = array();
     }
     //need to attach ajaxUpdate handler to refresh editables on pagination and sort
     TbEditable::attachAjaxUpdateEvent($this->grid);
 }
コード例 #2
0
 public function init()
 {
     parent::init();
     if (!is_null($this->totalExpression)) {
         $this->total = is_numeric($this->totalExpression) ? $this->totalExpression : $this->evaluateExpression($this->totalExpression);
     }
     $this->footer = true;
 }
コード例 #3
0
 /**
  * widget initialization
  */
 public function init()
 {
     parent::init();
     if (empty($this->url)) {
         $this->url = Yii::app()->getRequest()->requestUri;
     }
     $this->registerClientScript();
 }
コード例 #4
0
 public function init()
 {
     if (!$this->name) {
         throw new CException('You should provide name for TbEditableColumn');
     }
     parent::init();
     //need to attach ajaxUpdate handler to refresh editables on pagination and sort
     TbEditable::attachAjaxUpdateEvent($this->grid);
 }
コード例 #5
0
 /**
  * widget initialization
  */
 public function init()
 {
     parent::init();
     if (empty($this->url)) {
         $this->url = Yii::app()->getRequest()->requestUri;
     }
     $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
     $this->registerClientScript();
 }
コード例 #6
0
ファイル: TbEditableColumn.php プロジェクト: robebeye/isims
 /**
  *### .init()
  *
  * Widget initialization
  */
 public function init()
 {
     if (!$this->grid->dataProvider instanceof CActiveDataProvider) {
         throw new CException('EditableColumn can be applied only to grid based on CActiveDataProvider');
     }
     if (!$this->name) {
         throw new CException('You should provide name for EditableColumn');
     }
     parent::init();
     //need to attach ajaxUpdate handler to refresh editables on pagination and sort
     //should be here, before render of grid js
     $this->attachAjaxUpdateEvent();
 }
コード例 #7
0
ファイル: TbImageColumn.php プロジェクト: DarkAiR/test
    public function init()
    {
        if (empty($this->thumbnailUrl)) {
            $this->thumbnailUrl = '$data->' . $this->name;
        }
        $this->value = '
			CHtml::link(
				CHtml::image(' . $this->thumbnailUrl . ',"", array("style"=>"' . addslashes($this->imageStyle) . '")),
				$data->' . $this->name . ',
				array("target" => "_blank")
			);';
        parent::init();
    }
コード例 #8
0
ファイル: TbEditableColumn.php プロジェクト: DarkAiR/test
 /**
  *### .init()
  *
  * Widget initialization
  */
 public function init()
 {
     // #745 adding support for CArrayDataProviders only if based on a CModel array
     /* if (!$this->grid->dataProvider instanceOf CActiveDataProvider) {
     			throw new CException('EditableColumn can be applied only to grid based on CActiveDataProvider');
     		} */
     if (!$this->name) {
         throw new CException('You should provide name for EditableColumn');
     }
     parent::init();
     $this->registerScripts();
     //need to attach ajaxUpdate handler to refresh editables on pagination and sort
     //should be here, before render of grid js
     $this->attachAjaxUpdateEvent();
 }
コード例 #9
0
 /**
  * Initializes the column.
  */
 public function init()
 {
     parent::init();
     $this->jEditableOptions = CMap::mergeArray($this->defaultJEditableOptions, $this->jEditableOptions);
     if (!isset($this->jEditableOptions['type'])) {
         $this->jEditableOptions['type'] = 'text';
     }
     if ($this->jEditableOptions['type'] == 'select' && (!isset($this->jEditableOptions['loadurl']) && !isset($this->jEditableOptions['data']))) {
         throw new CException('zii', 'When jeditable type is "select", "loadurl" or "data" must be configured properly. The data loaded must be in "json" format.');
     }
     if (!isset($this->jEditableOptions['id'])) {
         $this->jEditableOptions['id'] = @$this->htmlOptions['id'] ? $this->htmlOptions['id'] : $this->id;
     }
     $this->event = !isset($this->jEditableOptions['event']) ? $this->jEditableOptions['event'] : 'click';
     $this->jEditableOptions['event'] = null;
     if (!$this->saveURL) {
         $this->saveURL = Yii::app()->getRequest()->requestUri;
     }
     $this->cssClass .= '-' . $this->id;
     $this->registerClientScript();
 }