protected function saveView(Gpf_Db_View $view, Gpf_Rpc_Form $form) {
        $view->set('accountuserid', $this->getUserId());
        $view->set('viewtype', $form->getFieldValue('gridcode'));
        $view->save();
        $view->load();
        
        $viewId = $view->get(Gpf_Db_Table_Views::ID);
        $viewColumns = Gpf_Db_Table_ViewColumns::getInstance();
        $viewColumns->deleteAll($viewId);
        $rorder = 0;
        $columns = new Gpf_Data_RecordSet();
        $columns->loadFromArray($form->getFieldValue('columns'));

        foreach ($columns as $column) {
            $viewColumn = new Gpf_Db_ViewColumn();
            $viewColumn->set('viewid', $viewId);
            $viewColumn->set('name', $column->get('id'));
            $viewColumn->set('sorted', $column->get('sorted'));
            $viewColumn->set('width', $column->get('width'));
            $viewColumn->set('rorder', $rorder++);
            $viewColumn->save();
        }
        $form->setInfoMessage($this->_('View %s saved',$form->getFieldValue('name')));
        $form->setField('Id',$view->getId());
        $activeViewsTable = Gpf_Db_Table_ActiveViews::getInstance();
        $activeViewsTable->saveActiveView($view->get("viewtype"), $viewId);
    }
 function init()
 {
     $this->setTable(Gpf_Db_Table_ViewColumns::getInstance());
     parent::init();
 }