ngx-datatable列标题工具提示被切断

时间:2018-11-29 22:23:48

标签: html angular ngx-datatable

<ngx-datatable-column [width]="24"
                                  [sortable]="true"
                                  [canAutoResize]="false"
                                  [draggable]="false"
                                  [resizeable]="false"
                                  [headerCheckboxable]="true"
                                  [checkboxable]="true">
            </ngx-datatable-column>
            <ngx-datatable-column name='Name' prop='formattedStudentName' [width]="400" [cellClass]="'se-list-item'">
                <ng-template let-column="column" ngx-datatable-header-template>
                    <ng-container>
                        <div ngbTooltip="Click on the word 'Name' to change the sort direction of the student list">
                            {{column.name}}
                        </div>
                    </ng-container>
                </ng-template>
                <ng-template let-value="value" let-row="row" ngx-datatable-cell-template>
                    <div>
                        <a href="#" (click)="!!onNameClicked(row)">{{value}}</a>
                    </div>
                </ng-template>
                </ngx-datatable-column>

这是我的代码的一部分。我需要对列标题使用ngbTooltip,但该指针在工作时会被数据表切断。如何防止它被切断?

1 个答案:

答案 0 :(得分:2)

<ngx-datatable-column name='Name' prop='formattedStudentName' [width]="400" [cellClass]="'se-list-item'">
            <ng-template let-column="column" ngx-datatable-header-template>
                <ng-container>
                    <div container="body" ngbTooltip="Click on the word 'Name' to change the sort 
direction of the student list">
                        {{column.name}}
                    </div>
                </ng-container>
            </ng-template>
            <ng-template let-value="value" let-row="row" ngx-datatable-cell-template>
                <div>
                    <a href="#" (click)="!!onNameClicked(row)">{{value}}</a>
                </div>
            </ng-template>
            </ngx-datatable-column>

通过使用工具提示将container =“ body”添加到div,它可以使工具提示窗口弹出ngx-datatable的边界。

旁注:在我的研究中,我发现对于ngbTooltip,您可以添加tooltipClass =“ className”来自定义工具提示窗口。