Example #1
0
 /**
  * Loads item count information from viewstate.
  * This method is invoked right after control state is loaded.
  */
 public function loadState()
 {
     parent::loadState();
     if (!$this->getEnableViewState(true)) {
         return;
     }
     if (!$this->getIsDataBound()) {
         $state = $this->getViewState('AutoColumns', array());
         if (!empty($state)) {
             $this->_autoColumns = new TDataGridColumnCollection($this);
             foreach ($state as $st) {
                 $column = new $this->AutoGenerateColumnName();
                 $column->loadState($st);
                 $this->_autoColumns->add($column);
             }
         } else {
             $this->_autoColumns = null;
         }
         $state = $this->getViewState('Columns', array());
         if ($this->_columns && $this->_columns->getCount() === count($state)) {
             $i = 0;
             foreach ($this->_columns as $column) {
                 $column->loadState($state[$i]);
                 $i++;
             }
         }
         $this->restoreGridFromViewState();
     }
 }
Example #2
0
 /**
  * Loads item count information from viewstate.
  * This method is invoked right after control state is loaded.
  */
 public function loadState()
 {
     parent::loadState();
     if (!$this->getIsDataBound()) {
         $this->restoreItemsFromViewState();
     }
     $this->clearViewState('ItemCount');
 }