简体   繁体   English

ag-grid自定义工具提示在单元格值更新后不起作用,仅在刷新网格后起作用

[英]ag-grid custom tooltip not working after cell value update, working after refresh of the grid only

Ag-grid custom tooltip not working after cell value updation using rowNode, but working after refresh. Ag-grid自定义工具提示在使用rowNode更新单元格值后不起作用,但在刷新后起作用。

ag grid version 20.1.0, custom tooltip not showing results after cell value updation using rowNode.setDataValue('product', 10); ag网格版本20.1.0,使用rowNode.setDataValue('product',10)更新单元格值后,自定义工具提示不显示结果; , value gets updating in the cell but on hover the value is not previewing. ,值会在单元格中更新,但悬停时该值不会预览。

<ag-grid-angular
          class="ag-theme-balham grid"
          [rowData]="rowData"
          [animateRows]="true"
          rowHeight="38"
          [enableRangeSelection]="true"
          [enableFilter]="true"
          [enableSorting]="true"
          [enableColResize]="true"
          [sideBar]="sideBar"
          [columnDefs]="columnDefs"
          [domLayout]="autoHeight"
          (gridReady)="onGridReady($event)"
          (rowClicked)="rowClicked($event)"
          [autoGroupColumnDef]="autoGroupColumnDef"
          [rowGroupPanelShow]="rowGroupPanelShow"
          [suppressNoRowsOverlay]="true"
          [suppressDragLeaveHidesColumns]="true"
          [suppressMakeColumnVisibleAfterUnGroup]="true"
          [frameworkComponents]="frameworkComponents"></ag-grid-angular>


  in TS:
----------

and setting cell value like this in the aggrid programtiaclly. 

        const id = this.selectedRow['id']; (grid - id -- dynamicvalue)
        const rowNode = this.gridApi.getRowNode(id);
        rowNode.setDataValue('status', 1);


        this.frameworkComponents = {
         customTooltipComponent: CustomTooltipComponent
        };


CustomTooltipComponent:-
---------------------------------------------------------------
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ITooltipAngularComp } from 'ag-grid-angular';
@Component({
  selector: 'app-custom-tooltip',
  template: `<div class="custom-tooltip">
  <div *ngIf="imageViewer"><img [src]="params.value" alt="" /></div>
  <div *ngIf="imageViewer === false">{{ params.value }}</div`,
  styleUrls: ['./custom-tooltip.component.scss']
})

class CustomTooltipComponent implements ITooltipAngularComp {
  private params: any;
  private data: any;
  public imageViewer: boolean;

           agInit(params): void {
               this.params = params;
           }

}
-----------------------------------------------------------------------

my expected result is after setting value, on hover of cell, i need to see the updated value as tooltip, with out refresh. 我的预期结果是在设置值之后,在单元格上悬停时,我需要将更新后的值作为工具提示,而无需刷新。

In your defaultColDefs of table try using tooltip key directly as follows: 在表的defaultColDefs中 ,尝试直接使用工具提示键,如下所示:

this.defaultColDef ={
      tooltip: (params) => {
        return params.name;
      }

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

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