拖动ngx-datatable,Angular4的列时如何滚动水平滚动条

时间:2017-11-24 06:36:01

标签: angular typescript ngx-datatable

我正在尝试在拖动ngx-datatable的列标题时滚动水平滚动条。我正在使用Angular4。在我的ngx-datatable中有水平滚动条,当我从左到右拖动第一列时,然后水平滚动条应该移动。当我从左向右拖动ngx-datatable列时,如何移动水平滚动条。请帮帮我

 <ngx-datatable
    class="material"
    [rows]="row"
    [columnMode]="'force'"
    [headerHeight]="50"
    [footerHeight]="50"
    [reorderable]="true"
    [scrollbarV]="true"
    [scrollbarH]="true"
    >
    <ngx-datatable-column name="Name" [minWidth]="150" 
        [resizeable]="true">
      <ng-template let-column="column" ngx-datatable-header-template >
        Name
      </ng-template>

      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template >
        <div>
          {{row['Name']}}
        </div>
      </ng-template>
  </ngx-datatable-column>    

   <ngx-datatable-column name="Address" [minWidth]="150" 
        [resizeable]="true">
      <ng-template let-column="column" ngx-datatable-header-template >
        Address
      </ng-template>

      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template >
        <div>
          {{row['Address']}}
        </div>
      </ng-template>
  </ngx-datatable-column>  


   <ngx-datatable-column name="Age" [minWidth]="150" 
        [resizeable]="true">
      <ng-template let-column="column" ngx-datatable-header-template >
        Age
      </ng-template>

      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template >
        <div>
          {{row['Age']}}
        </div>
      </ng-template>
  </ngx-datatable-column>  

</ngx-datatable>

1 个答案:

答案 0 :(得分:1)

需要这两个属性

[scrollbarV] =“ true” [scrollbarH] =“ true”

并添加组件css或全局样式。css此类:

。材料{     高度:550px }

“材质”是您的ngx数据表类,如果您想对其进行更改。