I have created a Table with selection using angular material. Now I want to check some particular rows in onchange method of a dropdown. I did so far:
- Created the table
- Load value in database
- Created dropdown and onChange method
- Created a save button that gives me the selected value and my dropdown value.
Now I am unable to check the row for the value based on onChange of the dropdown. My dataSource:
const ELEMENT_DATA: PeriodicElement[] = [
{ position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H' },
{ position: 2, name: 'Helium', weight: 4.0026, symbol: 'He' },
{ position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li' },
{ position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be' },
];
In onChange of my dropdown let say I want to check only this two-row
{ position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H' },
{ position: 2, name: 'Helium', weight: 4.0026, symbol: 'He' },
Noted:I should be able to check or uncheck after loading value and get a new checked value in my save button Here is my code in stackblitz
Aucun commentaire:
Enregistrer un commentaire