I have a boolean field in my db to indicate is a record is set to favorite or not
They only way to set the record to favorite now is to do it when adding the record or editing the record using a radio button
My question is how do i usecallback in order to set the value of favorite to 1=Yes or 0=No in the column itself., which means under the \
favorite column when i click yes on the data it become no, and when i click no it will become yes setting the boolean value of the field
to 0 or 1
the easiest way to show thisis the xcrud demo ajax button
http://xcrud.com/demos/index.php?page=action&theme=default
where when we click the x it becomes correct and vice versa
Thank you
public function lit_management()
{
$crud = new grocery_CRUD();
$crud->set_table('literature');
$crud->where('userid', $this->ion_auth->user()->row()->user_id);
$crud->set_relation('type_code','litcategory','catname');
$crud->display_as('type_code','Literature Type');
$crud->display_as('author_fname','Author(s)');
$crud->set_subject('Literature');
$crud->set_relation('relevant_code','littag','tagname');
$crud->display_as('relevant_code','Literature Citation');
$crud->display_as('file_url','Upload File');
$crud->display_as('isfav','Favourites');
$crud->required_fields('title');
$crud->columns('title','author_fname','type_code','your_tag','file_url','web_url','last_update','isfav');
$crud->set_field_upload('file_url','assets/uploads/files');
$crud->fields('title','author_fname','year','volume','type_code','your_tag','pages','topic','issue','file_url','web_url','relevant_code','description','isfav','userid');
$crud->field_type('userid', 'hidden', $this->ion_auth->user()->row()->user_id);
$crud->field_type('isfav', 'true_false');
$crud->callback_add_field('author_fname',function () {
return '<input type="text" maxlength="100" value="" name="author_fname" placeholder="Separate multiple authors using comma ,"> ';
});
$crud->callback_add_field('your_tag',function () {
return '<input type="text" maxlength="100" value="" name="your_tag" placeholder="Provide your own label for this literature"> ';
});
$output = $crud->render();
$data['judul'] = 'My Literatures';
$data['crumb'] = array( 'Literature' => '' );
$template = 'admin_template';
$view = 'hahaha';
$this->outputview->output_admin($view, $template, $data, $output);
}
this is my controller