在Primeng中,p表的粘贴标头无法与[scrollable] = true一起使用。

卡鲁伊·安瓦尔

我正在尝试在PrimeNg的p表中同时实现[scrollable] =“ true”和stick标头。但是,如果我不使用可滚动的标题,则粘性标头效果很好。如果同时实现这两个功能,则scrollable起作用,但粘性标头不起作用。

我使用了primeng的以下CSS作为粘性标头。

 :host ::ng-deep .ui-table .ui-table-thead > tr > th {
        position: -webkit-sticky;
        position: sticky;
        top: 69px;
        box-shadow: 1px 3px 6px 0 rgba(32,33,36,0.10);
    }

    @media screen and (max-width: 64em) {
        :host ::ng-deep .ui-table .ui-table-thead > tr > th {
            top: 99px;
        }
    }

对于滚动,我使用了以下代码, [scrollable]="true"

<p-table [columns]="cols" [value]="cars1" [scrollabe]="true">
...
 <th *ngFor="let col of columns" >

如果我删除[scrollable]="true"粘页眉工作正常。我怎样才能使它同时起作用呢?这是堆叠闪电战

亚亚

可滚动表中的结构不同。因此您应该将sticky样式赋予此祖先元素:

:host ::ng-deep .ui-table-scrollable-header{
  position: sticky;
  position: -webkit-sticky;
  top: 0;
  z-index: 1000;
}

在stackblitz上实时观看


描述问题的最小示例:

下面的sticky标头不起作用,因为我们在错误的元素上添加了粘性。要解决这个问题,我们应该添加sticky.header改为:

<div style="height: 1500px; background: #def;">
  <div class="header" style="background: #fed;"><!-- <- instead add sticky to here -->
    <div style="position: sticky;top: 0;">header</div> <!-- <-- not here -->
  </div>
  <div class="body" style="background: blue; height: 1500px;">
    <div>body</div>
  </div>
</div>

最低示例越野车版本| 最小示例固定版本

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

无法获得allowDiskUse:True与pymongo一起使用

来自分类Dev

PHP标头404无法与.htaccess一起使用?

来自分类Dev

标头xml中的空间与php一起使用

来自分类Dev

ng-grid中的UI-Bootstrap Datepicker无法与enableCellEditOnFocus = true一起使用

来自分类Dev

ng-grid中的UI-Bootstrap Datepicker无法与enableCellEditOnFocus = true一起使用

来自分类Dev

将Sonar MSBuild Runner与/ p:IsPackaging = True一起使用

来自分类Dev

jQuery UI sortable&contenteditable = true无法一起使用

来自分类Dev

Contenteditable =“ true”无法与jQuery UI Tabs一起正常使用

来自分类Dev

jQuery UI sortable&contenteditable = true无法一起使用

来自分类Dev

CSS无法与DOMPDF一起使用

来自分类Dev

supportFragmentManager无法与Kotlin一起使用

来自分类Dev

CSS无法与bootstrap一起使用

来自分类Dev

无法使砖石与RequireJS一起使用

来自分类Dev

reduce()无法与lightcouch一起使用

来自分类Dev

无法使Postgres与节点一起使用

来自分类Dev

MediaButtonReceiver无法与MediaBrowserServiceCompat一起使用

来自分类Dev

CABasicAnimation无法与UIImageView一起使用

来自分类Dev

updateSearchResultsForSearchController无法与UIViewController一起使用

来自分类Dev

无法与receiveOnly一起使用别名

来自分类Dev

JavaScript无法与php一起使用

来自分类Dev

NSURLCache无法与NSURLSession一起使用

来自分类Dev

QDataWidgetMapper无法与QLabels一起使用

来自分类Dev

FileProvider无法与相机一起使用

来自分类Dev

ResourceProcessor无法与PagedResources一起使用

来自分类Dev

$(this)无法与Flickr Gallery一起使用

来自分类Dev

Rabbitmq无法与Java一起使用

来自分类Dev

$ urlRouterProvider无法与ngClipProvider一起使用

来自分类Dev

removeObjectFromSuperView无法与if语句一起使用

来自分类Dev

AddEventListener无法与onClick一起使用

Related 相关文章

  1. 1

    无法获得allowDiskUse:True与pymongo一起使用

  2. 2

    PHP标头404无法与.htaccess一起使用?

  3. 3

    标头xml中的空间与php一起使用

  4. 4

    ng-grid中的UI-Bootstrap Datepicker无法与enableCellEditOnFocus = true一起使用

  5. 5

    ng-grid中的UI-Bootstrap Datepicker无法与enableCellEditOnFocus = true一起使用

  6. 6

    将Sonar MSBuild Runner与/ p:IsPackaging = True一起使用

  7. 7

    jQuery UI sortable&contenteditable = true无法一起使用

  8. 8

    Contenteditable =“ true”无法与jQuery UI Tabs一起正常使用

  9. 9

    jQuery UI sortable&contenteditable = true无法一起使用

  10. 10

    CSS无法与DOMPDF一起使用

  11. 11

    supportFragmentManager无法与Kotlin一起使用

  12. 12

    CSS无法与bootstrap一起使用

  13. 13

    无法使砖石与RequireJS一起使用

  14. 14

    reduce()无法与lightcouch一起使用

  15. 15

    无法使Postgres与节点一起使用

  16. 16

    MediaButtonReceiver无法与MediaBrowserServiceCompat一起使用

  17. 17

    CABasicAnimation无法与UIImageView一起使用

  18. 18

    updateSearchResultsForSearchController无法与UIViewController一起使用

  19. 19

    无法与receiveOnly一起使用别名

  20. 20

    JavaScript无法与php一起使用

  21. 21

    NSURLCache无法与NSURLSession一起使用

  22. 22

    QDataWidgetMapper无法与QLabels一起使用

  23. 23

    FileProvider无法与相机一起使用

  24. 24

    ResourceProcessor无法与PagedResources一起使用

  25. 25

    $(this)无法与Flickr Gallery一起使用

  26. 26

    Rabbitmq无法与Java一起使用

  27. 27

    $ urlRouterProvider无法与ngClipProvider一起使用

  28. 28

    removeObjectFromSuperView无法与if语句一起使用

  29. 29

    AddEventListener无法与onClick一起使用

热门标签

归档