Dancer-Plugin-SimpleCRUD icon indicating copy to clipboard operation
Dancer-Plugin-SimpleCRUD copied to clipboard

make filter use foreign key config

Open msouth opened this issue 12 years ago • 1 comments

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.)

msouth avatar Aug 16 '13 15:08 msouth

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).

joshrabinowitz avatar Oct 13 '16 16:10 joshrabinowitz