-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dada down actions up with custom search function is not possible. #1395
Comments
I'm somewhat confused. The component uses DDAU everywhere. Nothing relies on bindings propagating up. So, if you could elaborate what you want to create I might be able to give some directions. |
I was confused too, when I read following in documentation page When that's the case you can provide a search action instead of options (it's the only situation where the options are not mandatory) that will be invoked with the search term whenever the user types on the search box. You should return a collection or a promise that resolves to a collection from this action. So this mean that when I want to react on search action, then I am not able to fill options. It will show what search action return. So I am able to update data in dropdown only when user type something and dropdown fire search action (this mean it is not data down) because I am not able to provide new options at any point of time. For example I am not able to refresh options in every 30 seconds. What I would like to explain is that there is DDAU only when you do not provide search action. Do not understand me wrong, I am using ember-power-select in many places and it is working great, but I somehow do not understand why in case of custom search I cannot provide options directly. And this thing when user type something I am searching items in api, but when user clear textbox, then it will show initial set of options which was loaded from api 5 minutes ago and that data are irrelevant. So this is my frustration why it is not calling custom search when there is change in textbox. How would you implement scenario where you need custom search and you search options in api. User will type something to dropdown. Search is fired and it return a few options. Next to that dropdown is button "load options from different source" then when user clicks that button I am not able to provide new options set, because I need to wait until user type something to textbox only after that is search action fired and I can provide new options. That is direct violation of data down when I cannot show data I have. |
you can: <PowerSelect
@searchEnabled={{true}}
@search={{this.searchRepo}}
@options={{this.theOptions}}
@selected={{this.selected}}
@onChange={{fn (mut this.selected)}} as |repo|>
{{repo.full_name}}
</PowerSelect> and searchRepo() {
searchRepo(term) {
doSomethingAsync().then((newOptions) => this.set('theOptions', newOptions))l
// never return anything
}
} I generally do not advice this because now you are responsible for watching for race conditions when mutiple requests are fired in a short time period, cancelling requests if the component is destroyed, etc. Usually the component hides that complexity from you. |
If there was DDAU then I would be able to set options to ember-power-select. If user would like to search I sould be able to react to that action and then I would fill options with new set. If you provide search to ember-power-select then it show options from that action. So in current solution I am not able for example to search data and then refresh data every 30 seconds, because when you provide custom search, then you can return options only from search and only when search value is not empty and probable you cannot search if there is full moon on sky.
So I believe there should be possibility to fill options at any time to embe-power-select and I should be able to react to change of filter value with some action and of course I should be able to react to empty value too. And if options will be changed after custom search that is irrelevant. Then I can provide functionality as when you type show me dancing items, then I can react to that filter change and fill options accordingly every 15 second I can change order of options. But now I cannot fill options when there is empty value I cannot provide options every 15 seconds.
The text was updated successfully, but these errors were encountered: