Dancer-Plugin-SimpleCRUD
Dancer-Plugin-SimpleCRUD copied to clipboard
make filter use foreign key config
If you have a table with a foreign key and a name column defined, it would be nice for the filter for that column in the filter to give you a dropdown showing the name values to select from--or at least let you type that in instead of knowing the id of the row in the foreign key.
(I am just putting this here because I thought of it, I didn't look to see if there is already a capability or something in the works. Just didn't want to forget.)
Clearly fetching this data could require a potentially slow sql query and/or one with a large result set.
Perhaps there could be a optional config option (say, 'foreign_field_value_enums' or the like) to spec the allowed values for foreign key fields - which could dynamically fetch them from the database at runtime.
Also, this is similar to the case of a popdown appearing in the /add or /edit forms. (That case is somewhat supported by the CGI::FormBuilder options you can use in D:P:SC's 'validation' option. It doesn't apply to foreign keys, but you can use 'enum' fields get a dropdown ). The hypothetical 'foreign_field_value_enums' (or something even more general) could presumably apply to both cases (search field and add/edit forms).