I have a grid that holds rows of a Recipient record. The Recipient record has a number of foreign keys, e.g. PrimaryCaregiver, StatusId, NeedId, FacilityId, etc. that basically point to lookup tables.
The problem is filtering on the PrimaryCaregiver and NeedId - StatusId works fine.
@{
var person = (context as CareReceiverDto);
var status = (Statuses.FirstOrDefault(s => s.StatusId == person.StatusId)).Name;
@status
}
@{
var filterContext = (context as FilterItemTemplateContext);
int value = int.Parse(filterContext.Value.ToString());
var statusName = (Statuses.FirstOrDefault(s => s.StatusId == Convert.ToInt32(filterContext.Value))).Name;
}
@statusName
I use a Template and a Filter Template and the filtering and display are just fine.
When I attempt to do the same on the NeedId no filtering options are shown etc.
@{ var person = (context as CareReceiverDto); var needs = RecipientNeeds.Where(i => i.CareReceiverId == person.CareReceiverId).ToList(); foreach(var need in needs) { } }
@{
var filterContext = (context as FilterItemTemplateContext);
var name = Needs.FirstOrDefault(n => n.NeedId == Convert.ToInt32(filterContext.Value)).PrayerNeed;
}
@name
What am I doing wrong here?
Hi Mike,
Greetings from Syncfusion support.
We have analyzed your query and we have direct support to bind and display value in Grid which has foreign key behavior. We can perform filter operation in the Foreign Key column without additional code. We have already discussed about this topics detailly in our UG documentation. Kindly refer the documentation link shared.
Refer our UG Documentations :
https://blazor.syncfusion.com/documentation/datagrid/columns#foreign-key-column
Please get back to us if you have further queries.
Regards,
Naveen Palanivel