-
Notifications
You must be signed in to change notification settings - Fork 381
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
feat: allow to pass parameters to dialogs #2470
Comments
Hi, Because of vacation period, this will not see much activity in the coming weeks from my side. |
@vnbaaij don't worry. I just wanted to sort this one out of my large post because this is really important to me. Have a nice vacation! :) |
I support this request strongly. Nowadays I create separated class just for combining few objects from page from which I open Dialog. But I have more and more features/forms in my app so maintenance is getting harder. |
Hi @vnbaaij I've done some research on this. In my opinion the biggest downside of the This limits the use of this component by a lot. Since v5 will introduce a lot of breaking changes anyways I would like to suggest to get rid of the
This will allow the user to pass as many parameters as they want to the generic component which allows for much more complex implementations. Let me think what you think about this approach. |
@dvoituron is already working on that for v5 (code is in the dev-v5 branch)...
Example call:
peek_2.2.mp4 |
@vnbaaij you guys are my heros! I can't wait to get my hands on this! |
We aim to please! But getting this out will probable still take a while... |
Yea sure! At least I know that the end will come! :) |
I've taken another look on the draft by @dvoituron . I must say, I really really like this factory approach! Good job. |
🙋 Feature Request
I'm writing this feature request as a result of my discussion, which can be found here: #2443
The issue here is to collect and exchange feedback regarding the
DialogService
within this library. In my opinion, the current way dialogs work isn't very useful in many cases because their use case only fits in very specific ways.😯 Current Behavior
Currently, you can only bind to components that implement either
IDialogContentComponent
orIDialogContentComponent<T>
. In addition, you cannot pass additional parameters to the dynamic component. You either need to add them to your model or create custom parameters that inherit fromDialogParameters
and cast them within your component every time. Both ways result in much boilerplate code, which is hard to maintain.💁 Possible Solution
I would like to be able to use this kind of syntax:
The component itself should then create an instance of the provided component and fill all parameters. It would be even better if I could pass functions from the dialog itself as parameters.
🔦 Context
I want to pass additional parameters from outside to my dynamic component. For example, some sort of filters or rules for displaying content within the component itself.
In addition, I want to be able to use any component as a dynamic component for a dialog without having to implement the IDialogContentComponent or IDialogContentComponent interfaces every time.
💻 Examples
Let's say I have a component that displays a user list and allows me to filter them by name. So, I provide a filter class named
UserFilter
, which contains both age and username attributes.Now, I have certain views. The first view should always display users above the age of 18. The other one can be changed according to the user's needs. So, I don't want the user to change the value for the age filter in view 1.
In Blazor, I would achieve this like this:
View 1:
View 2:
The alternative would be to apply this property to my filter class, but I don't want to change my filter model. In some cases, I cannot change the class at all since I cannot modify the original source files.
The text was updated successfully, but these errors were encountered: