I have a controller like this:
function index()
{
$crud = new grocery_CRUD();
$crud->set_relation('name','parttype','type');
$crud->set_table('part');
$crud->set_subject('Items');
$output = $crud->render();
$this->_example_output($output);
}
I expected a dropdown field on the ADD/EDIT screens for the field "type" and for that dropdown to have options populated from parttypes table. But this code just returns text fields.
Here are my tables:
PARTTYPE TABLE
id -int,autocrement
name - varchar (500)
furl - varchar(500)
PART TABLE
id -int,autocrement
name - varchar (500)
type - varchar(500)
model - varchar (500)
Probably you are doing it wrong, I think the solution that you are looking for is this:
$crud->set_relation('type','parttype','name');