When I'm adding new data in list, it's showing 'Loading, saving data...' , with all buttons (Save, Save and go back to list, Cancel) active. Which is general behavior.
This continues to show even when data has been added to tables (I can see data has been updated in mysql). Page is not getting refreshed after adding. Same is happening when I delete the row (in list). Page is not getting refreshed after delete.
My controller is as below:
function view_company(){ $crud = new grocery_CRUD(); $crud->set_table('company'); $crud->set_subject('Company'); /*column in displayed table and fields to view/add/edit */ $crud->columns('Id','Name','Email','Address','LogoURL'); $crud->fields('Name','Description','Email','Address','LogoURL'); $crud->display_as('LogoURL','Logo'); /*required field in add/edit*/ $crud->required_fields('Name','Address'); $crud->set_field_upload('LogoURL','images'); $crud->unique_fields('Name','Email'); $crud->callback_after_insert(array($this,'create_company_db')); $crud->callback_after_delete(array($this,'delete_company_db')); $output = $crud->render(); $this->load->view('admin/view/company',$output); } function create_company_db($post_array, $primary_key){ if(empty($primary_key)){ return false; } $this->load->model('model_db_init'); $newdbname = "company_".$primary_key."_db"; $this->model_db_init->dbInitialize($newdbname); return true; } function delete_company_db($primary_key){ if(empty($primary_key)){ return false; } $newdbname = "company_".$primary_key."_db"; $this->load->model('model_db_init'); $db_deleted = $this->model_db_init->dbDeleteDB($newdbname); $this->load->model('model_admin'); $com = $this->model_admin->get_company_by_id($primary_key); $com = $com->row(); $img = $com['LogoURL']; $url= 'images/'.$com->LogoURL; chmod($url, 0777); unlink($url); /* redirect('settings_admin/view_company','refresh'); */ return $db_deleted; }
I tried using, redirect('settings_admin/view_company','refresh'); , but still it's not refreshing the page.
Also i want to display progress bar (message 'Loading, saving data...' ) in popup window so that user should not click on any button till the process is not finished.. How to do it?
Also there is issue in deleting file by unlink(). It's not deleting the file at given path.
In all there are three issues in above code:
1) Page is not getting refreshed after add/edit/update the data..
2) File is not getting deleted using unlink() and
3) How to display progress bar (message 'Loading, saving data...' ) in popup window so that users will not click any button during add/update/delete operation?
Can anybody help me to resolve these issues?