⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Confirmation Message on add_action ( )



dwdc

dwdc
  • profile picture
  • Member

Posted 13 August 2021 - 06:41 AM

I have a basic LIST where I am using add_action buttons to run some routines. All routines are working as expected ACCEPT when I delete a row, I want to display a javascript confirmation message alert( ). I am unable to figure out how to do this.

 

$crud->unset_delete();
            
            if($_SESSION['admin'] == 1) $crud->add_action('Edit', '', 'setlistsongs','ui-icon-pencil');
            if($_SESSION['admin'] == 1) $crud->add_action('Duplicate Set', '', 'dupesetlist','ui-icon-copy');
            if($_SESSION['admin'] == 1) $crud->add_action('Delete Set', '', 'deletesetlist','ui-icon-circle-minus');
            
            $output = $crud->render();
            
            $this->load->view('raw',(array)$output);

Here is the function:

public function deletesetlist($id){
   $this->load->model('admin_model');
   $this->admin_model->delete_set_list($id);
   redirect('setlist', 'refresh');
   return true;
}

Here is the MODEL function:

public function delete_set_list($id){
   $sql = 'DELETE FROM set_lists WHERE id = '.$id;
   $this->db->query($sql);
        
   $sql = 'DELETE FROM set_lists_songs WHERE setlist_id = '.$id;
   $this->db->query($sql);
}

I tried using the built in callback_after_delete ( ) function, which has the generic CONF message, but when it did the routine, the DATATABLES did not update and the delete row still showed in the list (NO REFRESH). So I do not know what worse...NO Confirmation Message or a dead row in the list.

Any insights and advice would be appreciated.

Don