sleeping-owl / admin

Administrative interface builder for Laravel
http://sleeping-owl.github.io/
MIT License
504 stars 259 forks source link

Is it possible to create dynamic select? #288

Closed yingliangzhang closed 7 years ago

yingliangzhang commented 8 years ago

Hi,

Just wondering is there a way to create a dynamic select, or in other words a select that depends on another select's selected value?

For example, I have a "Category" select and a "SubCategory" select, the sub-categories should be dynamically loaded depends on what Category is selected.

FormItem::select('category_id', 'Category')->list(\App\Category::class);
FormItem::select('sub_category_id', 'SubCategory')->list(\App\SubCategory::class);

But now the SubCategory select knows nothing about the Category. Can I pass in parameters to the list() method, such as category_id to retrieve the sub-category list?