<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Subscriber extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library('Datatables');
        $this->load->library('table');
        $this->load->database();
    }
    function index()
    {

        //set table id in table open tag
        $tmpl = array ( 'table_open'  => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable">' );
        $this->table->set_template($tmpl); 
        
        $this->table->set_heading('Reference Number','First Name','last Name','CNIC','Address','Meter Number','Initial Meter Reading','Consumer Type','Meter Reading Date','Region','Created By','Updated BY','Created On','Updated On','Status');

        $this->load->view('subscriber_view');
    }
    //function to handle callbacks
    function datatable()
    {
        $this->datatables->select('consumer_id,ref_number,first_name,last_name,cnic,address,meter_number,initial_meter_reading,consumer_type,meter_reading_date,region_id,created_by,updated_by,created_on,updated_on,status')
         ->unset_column('consumer_id')
		->from('consumer');   
        echo $this->datatables->generate();
    }
	
}