⚠ 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

Callback issue



leffert
  • profile picture
  • Member

Posted 16 April 2017 - 21:49 PM

Hi,

I got an issue with the callback functions (delete, update and add), its probably the same problem with them so I show the callback_update as an example. I get the ok message but no update happens in the db.

Can anybody see why this fails? All is working when using autofunctions, the add_action also works.

 

Using with codeigniter and bootstrap.

Im quite novice..

		public function managelibs() {
			$this->grocery_crud->set_table('smartstart_library_name');	
			$this->grocery_crud->set_subject('Bibl');
			$this->grocery_crud->where('smartstart_library_name.school_ID',$this->user->info->ID);
			
			$this->grocery_crud->fields('LID','school_ID','library_name','cols','rows','bckpic');
			$this->grocery_crud->field_type('school_ID','hidden',$this->user->info->ID);
			$this->grocery_crud->change_field_type('LID','invisible');
			
			$this->grocery_crud->columns('library_name','cols','bckpic');
			$this->grocery_crud->display_as('library_name','Name');
			$this->grocery_crud->display_as('cols','Columns');
			$this->grocery_crud->display_as('bckpic','Picture');
			$this->grocery_crud->required_fields('library_name');
			$this->grocery_crud->set_field_upload('bckpic','assets/uploads/files');
			
			$this->grocery_crud->add_action('Links', base_url('assets/links.png'), 'smartstart/showlinks');
			$this->grocery_crud->callback_delete(array($this,'delete_lib'));
		      //$this->grocery_crud->callback_update(array($this,'smartstart/update_lib'));
			$this->grocery_crud->callback_update(array($this,'update_lib'));
			
			$this->grocery_crud->unset_export();
			$this->grocery_crud->unset_print();
			$this->grocery_crud->unset_read();
			
			$output = $this->grocery_crud->render();
 			$this->template->loadContent('smartstart/managelibs.php',array("crud" => $output));
			}


		public function update_lib($post_array, $primary_key) {
			$this->db->where('LID',$primary_key);
		      //$this->db->where('school_ID',$this->user->info->ID);
			return $this->db->update('smartstart_library_name',$post_array);
			}