I have a question on previous forum(mentioned below)
/topic/303-extra-categories-and-subcategories-dropdown-list/
How can I use below code when we have to use category with multiple fields(for example editing/adding user info).
I have two tables(users and category) like below -
- "users" table have following fields --->user_id,name,gender,category.
- "category" table have following fields ---> id,category,parent_id
$this->load->library('grocery_CRUD');
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('users');
$crud->set_subject('Users');
$crud->set_relation('category', 'categories', 'category');
/* Add this customisation for parent_relation */
$primary_id_field = 'id';
$table_name = 'categories';
$relation_field_name = 'parent_id';
$parent_field = 'parent_id';
$title_field = 'category';
$title_display_as = 'Select Categoria';
$where = array('stato'=>'1');//not required
$same_table = true; //not required, the default is false
$this->set_parent_relation($primary_id_field,$table_name,$parent_field,$title_field,$crud,$title_display_as,$relation_field_name,$where,$same_table);
$output['output'] = $crud->render();
$this->load->view('template', $output);
Here how can I populate category like when I am using two tables.
Thanks in advance.