public function init()
 {
     parent::init();
     $this->addPocketData();
     $this->removeFromData();
     $this->grid->onRegisterScript = array($this, 'registerScript');
 }
Exemple #2
0
    /**
     * Initializes the column.
     *
     * @see CDataColumn::init()
     */
    public function init()
    {
        parent::init();
        if (!isset($this->htmlCheckBoxOptions['class'])) {
            $this->htmlCheckBoxOptions['class'] = 'checkBoxColumn-' . $this->id;
        }
        $cs = Yii::app()->getClientScript();
        $gridId = $this->grid->getId();
        $script = '
        jQuery(".' . $this->htmlCheckBoxOptions['class'] . '").live("click", function(e){

          $.ajax({
            type: "POST",
            dataType: "json",
            cache: false,
            url: "' . (is_array($this->actionUrl) ? CHtml::normalizeUrl($this->actionUrl) : $this->actionUrl) . '",
            data: {
                
                attr: "' . $this->name . '",
                model: "' . get_class($this->grid->filter) . '",
                item: $(this).attr("itemid"),
                checked: $(this).attr("checked")?1:0
            },
            success: function(data){
              //alert();
              $("#' . $gridId . '").yiiGridView.update("' . $gridId . '");
            }
          });
        });';
        $cs->registerScript(__CLASS__ . $gridId . '#active_column-' . $this->id, $script);
    }
Exemple #3
0
 /**
  * Initializes the column.
  *
  * @see CDataColumn::init()
  */
 public function init()
 {
     parent::init();
     if (!isset($this->selectBoxHtmlOptions['class'])) {
         $this->selectBoxHtmlOptions['class'] = 'selectColumn-' . $this->id;
     }
     $cs = Yii::app()->getClientScript();
     $gridId = $this->grid->getId();
     $script = '
     jQuery(".' . $this->selectBoxHtmlOptions['class'] . '").live("change", function(e){
       e.preventDefault();
       $.ajax({
         type: "POST",
         dataType: "json",
         cache: false,
         url: "' . (is_array($this->actionUrl) ? CHtml::normalizeUrl($this->actionUrl) : $this->actionUrl) . '",
         data: {
             item: $(this).attr("itemId"),
             value:$("option:selected",this).val()
         },
         success: function(data){
           $("#' . $gridId . '").yiiGridView.update("' . $gridId . '");
         }
       });
     });';
     $cs->registerScript(__CLASS__ . $gridId . '#active_column-' . $this->id, $script);
 }
 public function init()
 {
     parent::init();
     $this->assets = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias($this->assets)) . '/publishedColumn';
     $this->initVariables();
     $this->grid->onRegisterScript = array($this, 'registerScript');
 }
 /**
  * Initializes the column.
  */
 public function init()
 {
     parent::init();
     if ($this->name === null && $this->value === null) {
         throw new CException(Yii::t('zii', 'Either "name" or "value" must be specified for CEditableColumn.'));
     }
 }
	protected function renderHeaderCellContent()
	{
		$this->registerScripts();
		if ($this->headerText != null)
			echo $this->headerText;
		else 
			parent::init();
	}
 public function init()
 {
     if ($this->url == null) {
         $this->url = '/' . preg_replace('#' . Yii::app()->controller->action->id . '$#', 'sortable', Yii::app()->controller->route);
     }
     $this->registerScripts();
     parent::init();
 }
 /**
  * Initialises the column.
  * Sets the initial value for the total.
  */
 public function init()
 {
     parent::init();
     if (is_string($this->init)) {
         $this->init = $this->evaluateExpression($this->init);
     }
     $this->_total = $this->init;
     $this->_sortDesc = !empty($this->sort) && $this->grid->dataProvider->getSort()->getDirection($this->sort);
 }
 public function init()
 {
     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
     WhEditable::attachAjaxUpdateEvent($this->grid);
 }
Exemple #10
0
 /**
  * Initializes the column.
  */
 public function init()
 {
     if (isset($this->headerHtmlOptions['class'])) {
         $this->headerHtmlOptions['class'] .= ' header';
     } else {
         $this->headerHtmlOptions['class'] = 'header';
     }
     parent::init();
 }
Exemple #11
0
	public function init()
	{
	    parent::init();
	    
		if ($this->onButtonImageUrl === null)
			$this->onButtonImageUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.widgets.assets.gridview').'/check_icon.png');
		if ($this->offButtonImageUrl === null)
			$this->offButtonImageUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.widgets.assets.gridview').'/uncheck_icon.png');
			
		$this->registerClientScript();
	}
Exemple #12
0
 public function init()
 {
     // allows width to be set for column using width property
     if ($this->width) {
         $this->headerHtmlOptions['style'] = isset($this->headerHtmlOptions['style']) ? $this->headerHtmlOptions['style'] : '';
         $this->htmlOptions['style'] = isset($this->htmlOptions['style']) ? $this->htmlOptions['style'] : '';
         $this->headerHtmlOptions['style'] .= 'width: ' . $this->width . ';';
         $this->htmlOptions['style'] .= 'width: ' . $this->width . ';';
     }
     return parent::init();
 }
 public function init()
 {
     if (!$this->grid->dataProvider instanceof CActiveDataProvider) {
         throw new CException(Yii::t('zii', 'TbEditableColumn can be applied only to grid based on CActiveDataProvider'));
     }
     if (!$this->name) {
         throw new CException(Yii::t('zii', 'You should provide name for TbEditableColumn'));
     }
     parent::init();
     if ($this->isEditable($this->grid->dataProvider->model)) {
         $this->attachAjaxUpdateEvent();
     }
 }
 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();
 }
Exemple #15
0
 public function init()
 {
     parent::init();
     //$this->visible = false;//didnt work
     //$this->header = '';
     //if($this->name=='active'||$this->name=='created_on'||$this->name=='created_by'){
     if ($this->name == 'created_on' || $this->name == 'created_by') {
         $this->htmlOptions = array('class' => 'debug');
         $this->headerHtmlOptions = array('class' => 'debug');
         $this->footerHtmlOptions = array('class' => 'debug');
         $this->filterHtmlOptions = array('class' => 'debug');
     }
 }
Exemple #16
0
 /**
  * Initializes the column.
  */
 public function init()
 {
     if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
         $class = array();
         $class[] = 'header';
         if ($this->color !== null) {
             $class[] = $this->color;
         }
         $class = implode(' ', $class);
         if (isset($this->headerHtmlOptions['class'])) {
             $this->headerHtmlOptions['class'] .= $class;
         } else {
             $this->headerHtmlOptions['class'] = $class;
         }
     }
     parent::init();
 }
	public function init() 
	{
		parent::init();
		$this->uiDateFormat = $this->uiDateFormat ? $this->uiDateFormat : "yy-mm-dd";
		$this->attribute = $this->attribute ? $this->attribute : $this->name;

		$this->filter = Y::controller()->widget('ext.jui.FJuiDatePicker',
			array(
				'model'=>$this->model, 
				'attribute'=>$this->attribute,
				'language'=>'ru',
				'options'=>array(
					'dateFormat'=>$this->uiDateFormat
				)
			), 
			true
		);
	}	
 /**
  * Initializes the column.
  */
 public function init()
 {
     parent::init();
     if ($this->width) {
         if (is_int($this->width)) {
             $this->width .= 'px';
         }
         if (!$this->filterHtmlOptions['style']) {
             $this->filterHtmlOptions['style'] = "width: {$this->width};";
         } else {
             $this->filterHtmlOptions['style'] .= "width: {$this->width};";
         }
         if (!$this->headerHtmlOptions['style']) {
             $this->headerHtmlOptions['style'] = "min-width: {$this->width};";
         } else {
             $this->headerHtmlOptions['style'] .= "min-width: {$this->width};";
         }
         if (!$this->htmlOptions['style']) {
             $this->htmlOptions['style'] = "width: {$this->width};";
         } else {
             $this->htmlOptions['style'] .= "width: {$this->width};";
         }
     }
     if ($this->alignCenter) {
         if (!$this->filterHtmlOptions['style']) {
             $this->filterHtmlOptions['style'] = "text-align: center;";
         } else {
             $this->filterHtmlOptions['style'] .= "text-align: center;";
         }
         if (!$this->headerHtmlOptions['style']) {
             $this->headerHtmlOptions['style'] = "text-align: center;";
         } else {
             $this->headerHtmlOptions['style'] .= "text-align: center;";
         }
         if (!$this->htmlOptions['style']) {
             $this->htmlOptions['style'] = "text-align: center;";
         } else {
             $this->htmlOptions['style'] .= "text-align: center;";
         }
     }
 }
 /**
  * widget initialization
  */
 public function init()
 {
     parent::init();
     if (empty($this->url)) {
         $this->url = Yii::app()->getRequest()->requestUri;
     }
     $this->registerClientScript();
 }
 /**
  * Initializes the javascript needed to create the tooltip. The jQuery plugin needs to be included separately.
  */
 public function init()
 {
     parent::init();
     Yii::app()->clientScript->registerScript("tooltip_{$this->id}", "\$('.grid-tooltip-{$this->id}').tooltip({$this->tooltip_config})", CClientScript::POS_END);
 }