简体   繁体   English

如何减少 ag Grid 中 tooltipValueGetter 所花费的时间?

[英]How to reduce time taken by tooltipValueGetter in ag Grid?

 var ColDef = [{
        headerName: "colA",
        field: 'colA',
        rowGroup: true
      },
      {
        headerName: "colB",
        field: 'colB',
        pivot: true,
        enablePivot: true
      },
      {
        headerName: "colC",
        field: 'colC',
        rowGroup: true
      },
      {
        field: 'colD',
        aggFunc: 'last',
    tooltipValueGetter: commentTooltipValueGetter
      },
      {
        field: 'comment'
      },
      {
        field: 'colF'
      }
    ];


    function commentTooltipValueGetter(params) {
    const colB = params.colDef.pivotKeys[0];
    var model = params.api.getDisplayedRowAtIndex(params.rowIndex);
    for (var i = 0; i < model.allLeafChildren.length ; i++) {
        if (model.allLeafChildren[i].data.colB=== colB) {
          return model.allLeafChildren[i].data.comments;
                                                       }
                                             }
  }

For me when i hover over colD i get the comments as tooltip.对我来说,当我 hover over colD 时,我得到的评论是工具提示。 but they take like 2-3 seconds to come up.但它们需要 2-3 秒才能出现。 Any way to reduce this time?有什么办法可以减少这个时间? Also my agGrid is pivot and group ag Grid not the normal one.我的 agGrid 也是 pivot 和组 ag Grid 不是正常的。 Please take that into consideration when suggesting answers.请在建议答案时考虑到这一点。 I have been already using tooltipShowDelay before i asked this question, looks like sometimes its very fast and sometimes it takes couple of seconds hovering for the tooltipValueGetter to do its magic在我问这个问题之前,我已经在使用 tooltipShowDelay,看起来有时它非常快,有时它需要几秒钟的悬停时间才能让 tooltipValueGetter 发挥它的魔力

It doesn't look like you are doing a lot of processing, so ideally it should take less time.看起来您没有进行大量处理,因此理想情况下应该花费更少的时间。

From v23.1.0, ag-grid has provided this gridOption, tooltipShowDelay = 0 ;从 v23.1.0 开始,ag-grid 提供了这个 gridOption, tooltipShowDelay = 0 ;

AG-2968 [Feature Request] 23.1.0 Allow configuring how long it takes a tooltip to popup AG-2968 [功能请求] 23.1.0 允许配置工具提示弹出的时间

From docs -从文档 -

By default, when you hover on an item, it will take 2 seconds for the tooltip to be displayed.默认情况下,当您在一个项目上 hover 时,显示工具提示需要 2 秒。 If you need to change this delay, the tooltipShowDelay config should be used, which is set in milliseconds.如果您需要更改此延迟,则应使用 tooltipShowDelay 配置,该配置以毫秒为单位。

https://www.ag-grid.com/javascript-grid-tooltip-component/#tooltip-show-delay https://www.ag-grid.com/javascript-grid-tooltip-component/#tooltip-show-delay

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

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