During may way of getting used to the concepts and tool, I need some additional help, thanks in advance.
Inside a data grid, showing attachments, I am using a custom component in one of the columns, that only contains a data list, of tag names. The tag names are related to the AttachmentId of the data grid row.
My problem: if I reorder the data grid by clicking on the reorder icon in the column header of another column, the column showing the tags does not adapt its order -> wrong tags will be shown in the wrong row.
First approach: as you can see I tried to explicitly bind the AttachmentId value to my component (using a @bind-Value attribute), so it gets updated. Actually that's what I though this would do, according to this post. But that was just a first guess, and it looks as this is not my scenario.
In the documentation about custom components, I saw that the passed parameter is assigned to a property and according to this post I thought this causes the binding to row value, so my: Second approach was to store the passed parameter (AttachmentId) in a property inside the custom component, to provoke a callback to the load event.
I applied your code like this and it works. When I reorder the data grid, the column containing the custom component updates correctly. Thank you!
public partial class TagListComponent
protected override async Task OnAfterRenderAsync(bool firstRender)
I checked the content (and each fields) of _TagList and value, and they look the same (both debug views look like this):
Do I need to override the Equals method? or does it try to guess the primary key from the DB view and fails? (because the view does not have a primary key)
Sorry, if there is an obvious mistake, but currently I just can't spot it. Thanks for your advice.
Thank you, this condition was one part of the solution of my problem: means, before setting the property again and causing a reload I wanted to check all tags in my tag list component. But the equality check between the reloaded tag list for a row and the currently set tag list in this row, still returned false every time. What caused again a loop of SQL queries. Solution: I overrode the object method object.Equals() by creating a file AttachmentTagView.Custom.cs with this content:
public partial class AttachmentTagView : IEquatable<Object>
// The regular Equals method, was always false. I needed to determine equality by the content of the tag relation entry.
public override bool Equals(Object other)
if (other is null)
return this.TagId == ((AttachmentTagView)other).TagId && this.TagName == ((AttachmentTagView)other).TagName &&
this.ProjectId == ((AttachmentTagView)other).ProjectId && this.AttachmentId == ((AttachmentTagView)other).AttachmentId;
public override int GetHashCode() => (TagId, TagName, ProjectId, AttachmentId).GetHashCode();
The function SequenceEqual() seems to use that function.
Just thought, I post this here fyi. Thanks for pointing me to the right direction.