Could someone help me out. I am trying to set dynamically the selection in the Project Clarity datagrid component. https://vmware.github.io/clarity/documentation/v0.11/datagrid/selection I have a filter which I am fetching from storage and I want to display the selection in the datagrid. Here is the code for populating the selected variable which is string array (string[])
selected: string[] = [];
I am console outputting the selected and it contains the correct values but those are not selected in the datagrid.
private initView() {
Object.entries(this.metadataFilter.metadataTypes).forEach(
([key, value]) => {
this.selected.push(key);
});
console.log('this.selected: ', this.selected);
}
this is what I have in the template:
<clr-datagrid [(clrDgSelected)]="selected">
Here is the population of the rows:
<clr-dg-row *clrDgItems="let meta of metadataTypes | async" (click)="getItemsForMetadataType(meta.name)" [clrDgItem]="meta">
<clr-dg-cell>{{ meta.name }}</clr-dg-cell>
</clr-dg-row>
It works when I am selecting entries from the grid. Those I get populated to a variable but not other way around. Help would be very much appreciated. Am I misunderstanding how this should work ?