Ignited DataTables - Custom Column Link

Ignited DataTables - Custom Column Link

HayezbHayezb Posts: 10Questions: 1Answers: 0
edited December 2013 in General
Hi!

I'm using DataTabels with CodeIgniter. I've got the tables working and have created a column with a "view" link but I'm not able to get the Id to carry over to the controller it's linking to.


Controller for page with the table:

[code]
public function tableload(){

$this->load->database();
$this->load->library('Datatables');
$this->datatables->select('ID, ACCOUNTNAME, CONTACTNAME, CONTACTPHONE, EMAIL');
$this->datatables->from('ACCOUNTS');
$this->datatables->add_column('edit', 'view', 'id');

echo $this->datatables->generate();

}
[/code]


Controller for page where I'm wanting to edit the info based on the row they selected:

[code]
function account_info(){

$this->load->model('model_accounts');
$this->model_accounts->get_account();

$this->load->view('include/header');
$this->load->view('view_account', $data);
$this->load->view('include/footer');
}
[/code]


Model that is being called:

[code]
public function get_account() {

$query = $this->db->query("SELECT * FROM ACCOUNTS WHERE ID = 1");

if($query->num_rows() > 0){
foreach($query->result() as $row){
echo $row->accountname;
}
}

}
[/code]

I'm still learning CodeIgniter so if you need any more info please let me know!

Thanks!

Replies

  • HayezbHayezb Posts: 10Questions: 1Answers: 0
    I actually hardcoded the value of 1 in the model and still can't get anything to carry back over to the controller.
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    From what I remember of CI, shouldn't your Model be returning data to your Controller? At present your $data variable is empty.
    Having said that, I have no idea how "Ignited DataTables" works so my thought may be irrelevant.
This discussion has been closed.