示例#1
0
 public function setOrder($parameters = array())
 {
     $col = $parameters['col'];
     if (isset($parameters['gridid'])) {
         $grid = new mygrid($parameters['gridid']);
         $current = $grid->getOrder();
         //			$model = $grid->getModel();
         //			$assoc = $model->getAssoc();
         //			if(isset($assoc[$col])){
         //				if($assoc[$col]['type'] = 'map'){
         //					$col = $assoc[$col]['relationkey'];
         //				}
         //			}
         if (is_array($current)) {
             $field = $current['fields'][0];
             if ($field == $col) {
                 if ($current['type'] == 'ASC') {
                     $type = 'DESC';
                 } else {
                     $type = 'ASC';
                 }
             } else {
                 $type = 'ASC';
             }
         } else {
             $type = 'ASC';
         }
         $grid->setOrder(array('fields' => array($col), 'type' => $type));
         $template = new ui($this);
         $template->assign('grid', $grid);
         $this->response->assign($parameters['gridid'], 'innerHTML', $template->fetch($parameters['viewprefix'] . 'mygridstructure.tpl'));
     }
 }