Tree grid in the add can you control the buttons and prevent them from showing up to a sublevel?treegrid grouped by field ?
Hello Ricardo,
Can you be more specific regarding what buttons you want to show or hide?Are you referring a specific TreeGrid feature or TreeGrid sample?
The TreeGrid does not support grouping by field. If you have a non-hierarchical data you may implement an application logic which populates parent rows with aggregated values and present the data in the TreeGrid. You can find a sample and explanation here:https://ko.infragistics.com/products/ignite-ui-angular/angular/components/treegrid/aggregations.html
Sincerely,Radko
what I mean. is if there is a way to avoid creating more sub-levels in the treegrid for example one
1
1.1
1.1.1
And that there can no longer be created sub-levels And for that hide the button because there is a property that gives the levels ng-reflect-level = "1"
Regarding the ng-reflect-level = "1", which I think you see in the web browser's debugging tool when inspecting the DOM tree:These html attributes are added by the Angular framework and are used for debugging purposes. These are not properties you may use to configure the TreeGrid.
The levels shown by the TreeGrid are directly related to the data available in the data source bound to the TreeGrid.If you are referring to this sample:https://ko.infragistics.com/products/ignite-ui-angular/angular/components/treegrid/editing.html...which contains buttons for adding new records to the TreeGrid there is a way to configure the visibility of the buttons by changing the template used for the rightmost cell.The "add" and "delete" buttons are defined in the application logic in a template, which looks like this:
<ng-template igxCell let-cell="cell"> <div class="buttonsArea"> <button igxButton="icon" (click)="openDialog(cell.row.rowID)" class="emplBtn"> <igx-icon>person_add</igx-icon> </button> <button igxButton="icon" (click)="deleteRow(cell.row.rowID)" class="emplBtn"> <igx-icon>delete</igx-icon> </button> </div></ng-template>
If you modify the buttons by adding an *ngIf directive you may achieve conditional visibility for the buttons depending on the current record's level.For example the following modification:
<ng-template igxCell let-cell="cell"> <div class="buttonsArea"> <button igxButton="icon" (click)="openDialog(cell.row.rowID)" class="emplBtn" *ngIf="cell.row.treeRow.level == 0"> <igx-icon>person_add</igx-icon> </button> <button igxButton="icon" (click)="deleteRow(cell.row.rowID)" class="emplBtn" *ngIf="cell.row.treeRow.level == 0"> <igx-icon>delete</igx-icon> </button> </div></ng-template>
... will have the "add" and "remove" buttons visible only on the root level records.
In addition, if you need the logic to be related to a property in the data records you may modify the *ngIf like this:*ngIf="cell.row.rowData.ParentID == -1"This will result the logic to be connected to a property (in this case the "ParentID" property) of the data item.
Let me know if I may be of any further assistance.