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
Issue with using OnSelect event with FileManager #3010
Comments
@leigh-pointer can you verify for me if this is an issue? |
I definitely think there is a problem with the OnSelect Event callback, from what I have read that EventCallback call Have eaither of you dealth with this issue? |
Refer to this thread which has some workarounds hence I changed OnSelect to a Action from EventCallback |
@vnetonline I think the issue is that the FileManager was recently modified to utilize the OnParametersSet() method rather than the OnInitialized() method. This was done so that it is possible to change the values of parameters passed from your own component to the FileManager and have the FileManager respond to those changes. However there is a reference to OnSelect in this method:
I am not sure why it is necessary to call OnSelect in this method as the FileId is already known by the caller (it was passed as a parameter). So I think the OnSelect call should be removed. Either that, or the call to OnSelect should be move to OnInitialized() where it will only execute once - however I don't think it should execute at all. |
@vnetonline the other problem with your code is that when OnSelect is fired, you are not setting the variable in your calling component which holds the FileId parameter state. You specify FileId="@_slideFileId" as a parameter which means that _slideFileId holds the state and then when OnSelect is fired you are not assigning _slideFileId to the new value of fileid. This means that when FileManager is re-rendered, _slideFileId will still have the original value which was set on the initial render... which is -1. Your code should be modified to:
|
You are right @sbwalker the looping was being caused by
I have left
Thanks for your help @sbwalker first time making a module and fairly new to Blazor learning something every day. |
@sbwalked fixed this in #3024 |
I am trying to use the FileManager component so that iI can select an Image (File) it should populate the Name Field
Here is the code of the FileManager Component
Here is what I see when I edit an item - image flickers because FileId becomes -1 after the PopulateFileName is called because as per Blazor it automatically calls
StateHasChanged()
Here is what I see when I add an item - no image preview is displayed but the FileName is populated
The text was updated successfully, but these errors were encountered: