My question is simple, but not easy to do. I need height of all rows in my p-dataTable -> for example in array. It is possible to get all heights?
Asked
Active
Viewed 1,368 times
3 Answers
0
Try this, it's working for me!
::ng-deep .your-table .ui-datatable-scrollable-view .ui-datatable-scrollable-body {
min-height: 27vh;
}

rikg93
- 1,101
- 1
- 11
- 21
-
1While this code snippet may solve the problem, it doesn't explain why or how it answers the question. Please [include an explanation for your code](//meta.stackexchange.com/q/114762/269535), as that really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – Luca Kiebel Sep 10 '18 at 14:32
0
I get the result using this:
let rowHeights = document.getElementsByClassName("ui-datatable-tablewrapper");
let rowHeightsFiltered = rowHeights[0].children[0].children[1].children;
Then I put values to the array:
let eacheRowHeight = new Array;
for (let i = 0; i < rowHeightsFiltered.length; i++) {
eacheRowHeight.push(rowHeightsFiltered[i].clientHeight);
}

Iggsy
- 113
- 1
- 2
- 13
0
<ng-template pTemplate="body" let-rowData>
<tr pInitEditableRow [pEditableRow]="rowData" [pContextMenuRow]="rowData" style="height: 25px;">
<td style="width:130px;text-align:left" ><span icon="pi-folder"></span> {{rowData.COLUMN_NAME}}</td>
</tr>
</ng-template>
This Just Worked for me by adding the style property

ramaeon2
- 31
- 4