I have four tables:
items
*item_id*
vendor_id
title
vendors
*vendor_id*
title
vendor_locations
*location_id*
title
vendors_vendor_locations
vendor_id
vendor_location_id
priority
This is my controller:
$crud->set_theme('datatables');
$crud->set_subject('Items');
$crud->set_table('items');
$crud->set_relation('vendor_id', 'vendors', 'title');
$crud->set_relation_n_n('Locations', 'items_vendor_locations', 'vendor_locations', 'item_id', 'vendor_location_id', '{location_title} {country} {city}', 'priority');
How do I filter the relation_n_n depending on selection i made via vendor? For example: I select vendor 30 and the locations are filtered only showing locations of vendor 30 instead of all locations. I guess this is accomplished with the callback functions. Can anyone give me example or general direction how to do this?