BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
<ejs-treegrid #treegrid [dataSource]='data' height='400' childMapping='subtasks' [treeColumnIndex]='0'[editSettings]='editSettings' (actionComplete)='actionComplete($event)'>
<e-columns>
<e-column field='taskID' headerText='Task ID' isPrimaryKey='true' width='90' textAlign='Right' ></e-column>
<e-column width="150">
<ng-template #template let-data>
<button (click)="insert(data)" *ngIf="data.level == 0">INSERT CHILD</button>
</ng-template>
</e-column>
</e-columns>
</ejs-treegrid>
export class AppComponent implements OnInit{
public data: Object[] = [];
public editSettings: Object;
@ViewChild('treegrid')
public treegrid: TreeGrid;
ngOnInit(): void {
this.data = sampleData;
this.editSettings ={ allowEditing: true, allowAdding: true, allowDeleting: true, mode:"Row", newRowPosition: 'Child'};
}
insert(data: any) {
var value = { taskID: 33333, taskName: 'Plan timeline'};
this.treegrid.addRecord(value, data.index);
// call addRecord method with data and index of parent record as parameters
}
|
actionComplete(args): void {
if (args.requestType == "save") {
var index = args.index;
this.treegrid.selectRow(index); // select the newly added row to scroll to it
}
} |
Hi
in the sample: https://stackblitz.com/edit/angular-vrtsl2-198z7h
i added [enableCollapseAll]="true".
and i removed *ngIf="data.level == 0"
now i try addRecord into Quebec on Canada and addRecord into newRow then it went error.... https://stackblitz.com/edit/angular-vrtsl2-8vtkxe?file=app.component.html
help me please !!!
Thank in advance
Hoai Nam
Sample: https://stackblitz.com/edit/angular-vrtsl2-611zy3?file=app.component.html
and this is an error video when i try to do it : https://drive.google.com/file/d/1u0IN5-wrFuGp3Uo_m0Aul_eQE4h6o3-O/view?usp=sharing
i"m doing a project use tree grid with n level and CRUD that.
My produce version:
insert(data: any) {
var childRow = {
name: Math.random()
.toString(36)
.substring(7)
}; //unique name value
this.treegrid.addRecord(childRow, data.index);
// call addRecord method with data and index of parent record as parameters
} |