How to design complex filter component?


#1

I have to create transactions list page for admin. Admin should have opportunity to filter transactions by date range and user. Admin should choose user from autocomplete textbox. So I need to create user filter also. I want to create transactions-list component to show results of filtering and use it for both for admin and for user (without user filter). I have two route:

/admin/transactions

/user/:id/transactions

I have idea to create user-filter and transaction-filter user-filter will query users when admin is typing letters and when admin chose the user it will set this user in the transaction-filter. In this case if user was chosen transaction-filter will query transactions.

I don’t like this approach because user-filter and transaction-filter are very coupled and I need to request data in component.

Please advise the best practices for tasks like that.


#2

I probably don’t fully understand the case, but I personally would not worry too much about requesting type-ahead data in a component. I’d just set it with ember-concurrency similar to the example on this page