以下是显示“选择菜单”的视图,该菜单将根据所选过滤器调用另一个视图:
<form action="<?= base_url() ?>process/processfilter" method="post" >
<div class="col-md-2" >
<div class="form-group">
<label>Filter</label>
<select class="form-control" name="situation" required autofocus>
<option value="All">List All</option> Here I'd like to call another method that has no filter.
<option value="Processing">Processing</option>
<option value="Concluded">Concluded</option>
<option value="Archived">Archived</option>
</select>
</div>
</div>
</form>
控制器类中的功能:
public function processfilter($situation) {
$this->load->model('ProcessModel', 'processo');
$dados['process'] = $this->process->getProcess($situation);
if ($this->process->getProcess($situation)) {
$this->load->view('/reports/process', $dados);
} else {
redirect('dashboard', 'refresh');
}
}
类模型中的功能
function getProcesss($situation) {
$this->db->select('*');
$this->db->where("situation", $situation);
return $this->db->get('process')->result();
}
注意:我需要像在Excel中那样在视图中进行过滤。