I have a datagrid that displays two columns: both columns may show repeating record values, but each record would be unique
For example:
Control | Validation
ID.AM-01 | Evidence
ID.AM-01 | Interview
ID.BE-01 | Interview
PR.AC-01 | Observation
PR.AC-01 | Evidence
In this example I would like to show only one 'Evidence' row and only one 'Interview' row. 'Observation' already only has one record so its fine. If possible, for repeating values in the 'Validation' column, I would instead like to show a list of all the 'controls' that have that validation applied in the 'Control' column next to the related validation. So it would look like this:
Control | Validation
ID.AM-01, PR.AC-01 | Evidence
ID.AM-01, ID.BE-01 | Interview
PR.AC-01 . | Observation
I do not want to use grouping for this because I do not want the group headers, but i realize what I am asking is similar to grouping.
What is the most effective method for accomplishing this? Also, I have checkboxes for each record. I would like to remove a record from view if I click its checkbox. I do not want either of these actions to affect the datasource, only what the user sees in the table. Thanks!
I solved one part. I am able to generate the control list for each evidence type using a 'for each' statement and badges in the column template:
@foreach (Compass.Models.CompassData.SubControlEvidence item in getSubControlEvidencesResult.Where
( i => i.EvidenceTypeId == data.EvidenceTypeId))
{
<RadzenBadge IsPill= "true" BadgeStyle="BadgeStyle.Info" style="margin-left: 8px; margin-TOP: 16px;
font-size: 10px; font-weight: 400; padding-bottom: 4px; padding-left: 8px; padding-right: 8px; padding-top: 4px "
Text="@(subcontrols.Where( i => i.Id == item.SubControlId).FirstOrDefault().Abbreviation)" ></RadzenBadge>
}
Result:
As you can see, my second issue still exists. 'Personnel Testimony' is applied to 2 controls, thus shows up twice... I still need to show only one entry for the repeated value in the second column. I tried ${getSubControlEvidencesResult.Distinct()}
as the datasource, but this did nothing.
I solved my issue with a group parameter at loading the datasource:
${getSubControlEvidencesResult.GroupBy(s => s.EvidenceTypeId).Select(grp => grp.FirstOrDefault());}
Result:

Now just need a way to remove items from the datagrid view using the checkboxes? The check boxes are not hard coded to the record, only added in the view. This part I don't know where to start. I assume it would require adding a filter to preexisting current filters on the fly. Can anyone give me an example or provide some insight? Thanks!
I would just filter the unneeded items from the collection which you use to set the Data property of your RadzenDataGrid. Trying to do this via grouping seems unnecessary.
Thanks @korchev, The framework designs, evidence, and validations I am implementing are dynamic and their values can change and be customized within the app, therefor hardcoding filtering their values at the data property would not be viable. For example, I cannot filter out the specific repeated 'Personnel Testimony' record because that may not always be an item available in the visible collection.
Do you have any advice as to how I can dynamically remove specific rows from the datagrid view?
Only through filtering the data.
What is the best way to apply a dynamic filter that wont affect any filters already applied to the collection?
You could use the Where Linq extension method and apply the required filter to your data.
Thanks @korchev, I understand that. How can I apply it dynamically, say at the click of a button, or checking a box, without removing or breaking filters that are already applied at the datasource collection? Really it is just the syntax and method for application i am unsure of.