Ignited DataTables - Custom Column Link
Ignited DataTables - Custom Column Link
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!
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!
This discussion has been closed.
Replies
Having said that, I have no idea how "Ignited DataTables" works so my thought may be irrelevant.