I have a little Table setup and in one column are a bunch of buttons. Those call a method with a parameter which I get from the whole context part of the table. Now this produces some weird behavior and I can't quite understand, when and why it works.
When using a table you also do something with the GC and I have a feeling, that its something there, that produces this problem...
Hello!
Thanks for using MatBlazor.
Can you please post an example in BlazorFiddle where you reproduce this problem? https://blazorfiddle.com/
Mhh I just played around a bit more and I think there is a problem if you combine this with a MatDialog...
Well I just tested it in BlazorFiddle and for some reason it works...
Anyway here an example:
BlazorFiddle
Then the problem must be somewhere else -.-
The button click event gets propagated to the table row click event, and that can lead to strange problems if you're trying to bind to both events. So in version 2.3.0 we added OnClickStopPropagation to MatButton and MatIconButton. Try adding OnClickStopPropagation=“true” to your button.
Ok so I finally have found the main problem.
The part with OnClickStopPropagation helped a bit but still didn't fix it completely. My main error was, that I was populating the table with a list, that was set inside of OnAfterRenderAsync. Because I didn't check for firstRender in there, the List was reset every half second or so. Because of that I guess WASM had quite some problems to actually get the button-event due to the table being reloaded twice every second...
I guess this was just a huge fail from my side but still thanks for the help 👍
Great to hear it worked out! I'm closing this issue!
Hijacking this issue: @RonPeters could you register your github account on https://gitter.im/ ? We have an ongoing discussion between collaborators that we would like you to join! I cannot add you to the room until you have logged in once on gitter with your github account :)
@lindespang Done
Most helpful comment
Ok so I finally have found the main problem.
The part with OnClickStopPropagation helped a bit but still didn't fix it completely. My main error was, that I was populating the table with a list, that was set inside of OnAfterRenderAsync. Because I didn't check for firstRender in there, the List was reset every half second or so. Because of that I guess WASM had quite some problems to actually get the button-event due to the table being reloaded twice every second...
I guess this was just a huge fail from my side but still thanks for the help 👍