- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试使用 PrimeNG turbotable使用自定义大小 (500px),我希望列宽可以自动设置,但它不起作用。我得到一个水平滚动条,总宽度似乎固定在 767 像素。如果我尝试手动设置列宽,它会被忽略。如果我不设置表格宽度并尝试将其放在 500 像素宽的 DIV 中,我仍然会得到相同的结果(水平滚动条)。
下面是(非常简单的)代码:
<p-table #dt [value]="statusChangesData" [paginator]="true" [alwaysShowPaginator]="false" [rows]="2" [style]="{'width':'500px'}">
<ng-template pTemplate="caption" >
<div class="tableCaption">
<span translate>Status changes</span>
</div>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr>
<td [attr.colspan]="3">
<span translate>There are no data into the table</span>
</td>
</tr>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th style="width:200px" [pSortableColumn]="'date'"><span translate>Date</span><p-sortIcon [field]="'date'"></p-sortIcon></th>
<th style="width:200px" [pSortableColumn]="'status'"><span translate>Status</span><p-sortIcon [field]="'status'"></p-sortIcon></th>
<th style="width:100px" [pSortableColumn]="'userId'"><span translate>User ID</span><p-sortIcon [field]="'userId'"></p-sortIcon></th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-col>
<tr>
<td>{{col.date}}</td>
<td>{{col.status}}</td>
<td>{{col.userId}}</td>
</tr>
</ng-template>
</p-table>
这是它的样子:
如您所见,页眉和分页器都遵循我设置的宽度 (500px),但表格的正文不这样做。
我已经尝试了所有我能在堆栈溢出中找到的建议,包括设置像这样的样式:[style]="{'width':'200px'}
或使用 [autoLayout]="true"
但似乎没有任何效果。我是使用 primeNG 7.0.0。
附言。我真的不在乎手动设置每个列宽。我只是不想要水平滚动条。
最佳答案
如果有人遇到类似问题,请尝试将表格的最小宽度设置为 0:
::ng-deep .ui-table .ui-table-wrapper table {
min-width: 0px;
}
关于html - 具有自定义宽度的 PrimeNG TurboTable 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55141107/
我有一个简单的 TurboTable,我在其中显示了一些数据,包括日期。 Number
有没有办法将 customSort 仅应用于 TurboTables 的一列并允许其他列使用默认排序? 该文档将 customSort 应用于整个表。 https://www.primefaces.o
我正在尝试将现有的 PrimeNG 数据表转换为新发布的 TurboTable 规范,并且我已经能够或多或少地轻松地工作,但是我丢失了列标题上自动生成的排序方向指示符。 是否有基于 p-table 提
我正在使用带有嵌套行的 PrimeNG TurboTable。将数据加载到 TurboTable 时会出现严重的性能问题,例如渲染需要大约 30 秒,并且需要 10 多秒才能稳定,数据从服务器加载,并
所以我有一个表,其中包含在应用程序的使用过程中填充的数据。当用户单击一行时,该行将突出显示,并且该行的数据将填充在表下方。我只是想禁用用户取消选择行的选项(这是通过再次单击该行来完成的)。 代码:
我正在使用 primeng turbotable 但默认情况下无法展开所有原始文件。 https://stackblitz.com/edit/angular-qccqg8 已经尝试过以下示例,但似乎不
我正在使用 turbo 表并需要以下内容: 让所有列根据内容自动调整大小。 让表格本身水平填充屏幕,例如不要手动指定宽度 当自动调整大小的列需要的空间超过表格宽度所能提供的空间且无需手动指定任何列宽时
我有一个 PrimeNg turbotable具有行扩展功能。 如何默认展开行。 这是我的代码: HTML {{col.hea
是否可以使用按钮远程清除多选(或多个多选)?我正在使用带有涡轮表的 Primeng 多选 我已经多次看到这个问题,但没有选择答案。 下面是我的多选: 这是我的按钮: 这是我尝试重
p-table 上的 dataKey 属性是否需要定义为列,还是只需要是 [value] 数组中对象的属性?如果它需要是一个列,这个列是否需要可见? 最佳答案 不,dataKey 不需要是一列。 da
我在 Angular 7 应用程序上使用 PrimeNG TurboTable 组件,并且有一个按钮可以向它添加新行。问题是,当添加新行时,用户必须向下滚动到表格底部才能开始编辑它。我怎样才能滚动到它
我在 Angular 7 应用程序上使用 PrimeNG TurboTable 组件,并且有一个按钮可以向它添加新行。问题是,当添加新行时,用户必须向下滚动到表格底部才能开始编辑它。我怎样才能滚动到它
我无法在 PrimeNG 的新 TurboTable 中使用自动布局。无论内容和浏览器宽度如何,所有列都具有相同的宽度。 我尝试过[autoLayout]="true"以及autoLayout="tr
我正在使用带有延迟加载选项的 PrimeNG 的 TurboTable 来显示来自数据库的数据。这很完美。现在,我需要向发送到服务器的请求添加一些过滤器。怎么做? 这里是有效的代码:
我正在尝试使用 PrimeNG turbotable使用自定义大小 (500px),我希望列宽可以自动设置,但它不起作用。我得到一个水平滚动条,总宽度似乎固定在 767 像素。如果我尝试手动设置列宽,
我正在用 PrimeNG 的 turbotable 替换定制的 table 。我有一些按钮需要插入到表中,这些按钮调用了我编写的特殊 javascript 函数,但我一直在研究如何将元素插入到表中。
我已经实现了一个使用 PrimeNG TurboTable 和 NgRx 的自定义网格组件,并且我已经使用内置的 TurboTable 虚拟滚动向它添加了虚拟滚动功能。它也是延迟加载,使用 onLaz
我无法弄清楚如何使用 Angular 6 和 PrimeNG turbo 表获取索引。 这是我对它应该如何工作的最佳猜测。 {{ i }}{{ timecard.value }}
我是一名优秀的程序员,十分优秀!