Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- public function getDataTable()
- {
- $this->load->library('Datatables');
- $this->filtroListItens('datatables');
- $this->datatables
- ->select('id, nome, email')
- ->from('tabela');
- return $this->datatables2->generate();
- }
- public function getDados()
- {
- $this->filtroListItens('db');
- $query = $this->db
- ->select('id, nome, email')
- ->from('tabela');
- ->get();
- if ($query->num_rows() > 0) {
- return $query->result();
- }
- return array();
- }
- protected function filtroListItens($lib = 'db')
- {
- $busca = $this->input->post('busca');
- $tipo = $this->input->post('tipo');
- if ($busca && $busca != '') {
- $this->$lib->where('busca', $busca);
- }
- if ($tipo && $tipo != '') {
- $this->$lib->where('tipo', $tipo);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement