inventory-items #42
| @ -23,8 +23,6 @@ | |||||||
|     </td> |     </td> | ||||||
|   </ng-container> |   </ng-container> | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   <ng-container matColumnDef="property"> |   <ng-container matColumnDef="property"> | ||||||
|     <th mat-header-cell *matHeaderCellDef>Value</th> |     <th mat-header-cell *matHeaderCellDef>Value</th> | ||||||
|     <td mat-cell *matCellDef="let itemProperty"> |     <td mat-cell *matCellDef="let itemProperty"> | ||||||
| @ -54,7 +52,7 @@ | |||||||
| 
 | 
 | ||||||
|   <ng-container matColumnDef="expand"> |   <ng-container matColumnDef="expand"> | ||||||
|     <th mat-header-cell *matHeaderCellDef aria-label="row actions"> |     <th mat-header-cell *matHeaderCellDef aria-label="row actions"> | ||||||
|       <button mat-icon-button><mat-icon>add</mat-icon></button> |       <button mat-icon-button [disabled]="editedItemProperty !== undefined" (click)="addItemProperty()"><mat-icon>add</mat-icon></button> | ||||||
|     </th> |     </th> | ||||||
|     <td mat-cell *matCellDef="let element"> |     <td mat-cell *matCellDef="let element"> | ||||||
|       <button mat-icon-button aria-label="expand row" (click)="(expandedElement = expandedElement === element ? null : element); $event.stopPropagation()"> |       <button mat-icon-button aria-label="expand row" (click)="(expandedElement = expandedElement === element ? null : element); $event.stopPropagation()"> | ||||||
|  | |||||||
| @ -50,6 +50,12 @@ export class ItemPropertyEditorComponent implements OnInit{ | |||||||
|     } else { |     } else { | ||||||
|       this.editedItemProperty = undefined |       this.editedItemProperty = undefined | ||||||
|     } |     } | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|  |   addItemProperty() { | ||||||
|  |     const itemProperty = new ItemProperty("New Property", "", 0); | ||||||
|  |     this.item!.itemProperties.push(itemProperty); | ||||||
|  |     this.datasource.data = this.item!.itemProperties; | ||||||
|  |     this.editedItemProperty = itemProperty; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user