Syncfusion TreeGrid имеет «автоматическую» поддержку высоты, с помощью которой пользователь может отображать все записи в TreeGrid без вертикальной полосы прокрутки.В этом случае полоса прокрутки браузера появится, если высота TreeGrid превысит порт просмотра браузера, и это можно сделать, установив свойство sizeSettings.height в качестве автоматического.Пожалуйста, обратитесь к приведенному ниже фрагменту кода.
<ej-treegrid id="TreeGridContainer" [dataSource]="treeGridData"
sizeSettings.height="auto"
//…
</ej-treegrid>
Мы также можем отобразить TreeGrid без полосы прокрутки и с фиксированной высотой, используя create , свернутый , расширенный, actionComplete клиентские события с некоторым обходом.Пожалуйста, обратитесь к приведенному ниже фрагменту кода.
[HTML]
<ej-treegrid id="TreeGridContainer" [dataSource]="treeGridData"
(create)="create($event)" (collapsed)="collapsed($event)" (expanded)="expanded($event)" (rowSelected)="rowSelected($event)" (actionComplete)="actionComplete($event)"
//..
</ej-treegrid>
[TS]
create(args) {
/To update the height of TreeGrid during load time
this.updateTreeHeight();
}
collapsed(args) {
//To update the height of TreeGrid during collapse action
this.updateTreeHeight();
}
expanded(args) {
//To update the height of TreeGrid during expand action
this.updateTreeHeight();
}
rowSelected(args) {
//To update the height of TreeGrid while adding any row
this.updateTreeHeight();
}
actionComplete(args) {
//To update the height of TreeGrid while saving the newly added row and deleting the existing row
if (args.requestType == "addNewRow" || args.requestType == "delete") {
this.updateTreeHeight();
}
}
updateTreeHeight=function() {
var tree = $("#TreeGridContainer").ejTreeGrid("instance"),
toolbar = $("#TreeGridContainer_toolbarItems").height(),
model = tree.model,
totalLen = tree.getExpandedRecords(model.updatedRecords);
if (toolbar == undefined)
toolbar = 0;
//To calculate the height of TreeGrid as per records count
var height = model.rowHeight * totalLen.length + tree.getHeaderContent().height() + toolbar + 4;
//Update height using setModel
var sizesettings = { height: height.toString() };
tree.setModel({ "sizeSettings": sizesettings });
}
Пожалуйста, найдите образец ссылки ниже http://www.syncfusion.com/downloads/support/directtrac/general/ze/TreeGrid_without_scrollbar-1219686615
С уважением,
Punniyamoorthi