简体   繁体   English

带有可滚动的primeng数据表模板头

[英]primeng datatable template header with scrollable

I have a datatable 我有一个数据表

<p-dataTable ... > 
        <p-column field="name" header="Name" [style]="{'width':'250px'}"> 
               <template pTemplate type="header">
            <mycomponent> </mycomponent>
            </template>
    </p-column>
    ...
    </p-dataTable>

Mycomponent basically contains a button when clicked open a hidden div. 单击打开隐藏的div时,Mycomponent基本上包含一个按钮。 Which act like a modal and has absolute positioning. 像模态一样具有绝对定位。 See the picture below 见下图 https://s16.postimg.org/4ugtpunud/primeng_scrollable.png It works fine but if I add the scrollable option 它工作正常,但如果我添加可滚动选项

<p-dataTable ...  scrollable="true" scrollHeight="200px" scrollWidth="75%">

then the modal box is hidden like in the picture. 然后模态框被隐藏起来,如图所示。 I don't manage to put it on top. 我没有把它放在首位。 I tried with z-index but it doesn't work. 我尝试使用z-index,但是它不起作用。 Could you see why I have this different behaviour? 你知道我为什么有这种不同的行为吗? Thanks 谢谢

Use appendTo="body" in your p-multiSelect tag. 在您的p-multiSelect标签中使用appendTo =“ body”。 This will add the dropdown to your column header. 这会将下拉列表添加到您的列标题中。

Eg : 例如:

<p-column field="Description" ...>
<template pTemplate="filter" let-col>
  <p-multiSelect appendTo="body" ... ></p-multiSelect>
</template>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM