/** * Loads viewstate into this control and its children. * This method is overriden to load the items data from view state. * If the items data is equal to or greater than 0, it will be used to * populate the data list (to restore the previous view). * @param array viewstate to be loaded */ public function loadViewState($viewState) { parent::loadViewState($viewState); $cols = $this->getViewState('Columns', array()); foreach ($this->columns as $index => $column) { if (isset($cols[$index])) { $column->loadViewState($cols[$index]); } } $this->setViewState('Columns', null, null); $items = $this->getViewState('Items', array()); $this->setViewState('Items', null, null); if (count($items) >= 0) { $this->setDataSource($items); $this->dataBind(); } }
/** * Loads viewstate into this control and its children. * This method is overriden to load the items data from view state. * If the items data is not empty, it will be used to * populate the data list (to restore the previous view). * @param array viewstate to be loaded */ public function loadViewState($viewState) { parent::loadViewState($viewState); $items = $this->getViewState('Items', array()); if (count($items) > 0) { $this->setDataSource($items); $this->dataBind(false); } }