Hello,
I have problem with set relation. When edit form shows, i would like to filter results in dropdowns by category id. (Show only news in same category of slider )
My db structure:
My scripts:
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('Slider');
$crud->set_subject('Sides');
$crud->required_fields("slide_1_news_id","slide_2_news_id","slide_3_news_id","slide_4_news_id","slide_5_news_id");
$crud->set_relation('slide_1_news_id','News','news_title');
$crud->set_relation('slide_2_news_id','News','news_title');
$crud->set_relation('slide_3_news_id','News','news_title');
$crud->set_relation('slide_4_news_id','News','news_title');
$crud->set_relation('slide_5_news_id','News','news_title');
$crud->set_relation('category_id','Category','category_name');
$crud->display_as('category_id','Category')
->display_as('slide_1_news_id','First news')
->display_as('slide_2_news_id','Second news')
->display_as('slide_3_news_id','Third news')
->display_as('slide_4_news_id','Fourth news')
->display_as('slide_5_news_id','Fifth news');
$crud->field_type("category_id","readonly");
$output = $crud->render();
Regards,
Attila