mlrv / ng-material-treetable

Angular Material treetable component :deciduous_tree: :heart: ♻️
http://ng-material-treetable.surge.sh
MIT License
99 stars 65 forks source link

Add code #35

Closed CWBittencourt closed 4 years ago

CWBittencourt commented 4 years ago

Could you add this code to the project to facilitate the retrieval of information for deletion and editing?

in treetable.component.ts

@Output() lineClick: Subject = new Subject(); onLineClick(line: T): T{ return line; }

in treetable.component.html add (click)="onLineClick(element)"

mat-cell *matCellDef="let element" [ngClass]="{'vertical-separator': options.verticalSeparator}" (click)="onLineClick(element)"

result on click

image

mlrv commented 4 years ago

Hi @CWBittencourt , there's already a nodeClicked event for this use case, see here

CWBittencourt commented 4 years ago

This event only works for the main node. What I proposed works for any selected row. I need to retrieve the value of any selected row and not just the main node.

peterAzv commented 4 years ago

I don't know this issue was closed a event to get the values from the line is very usefull.