【问题标题】:Ag-Grid row groups rendering bugAg-Grid 行组渲染错误
【发布时间】:2020-01-08 23:50:21
【问题描述】:

我只是根据某些值对行进行分组。这是我的数据库结构的简化版本:

  • 项目
    • 身份证
    • 父 ID(如果这是子项)
    • 项目类型(父、子、普通)

当行的项目类型为父项时,我正在分组。我为该行的子项进行数据库提取,并将它们填充到行组中。

我最终遇到了一个非常奇怪的渲染问题: (GIF)https://imgur.com/a/8lFVjLn

这是我的代码。它是 CoffeeScript,但对于那些熟悉 JS 的人来说应该是不言自明的。 “?”只是一个空检查,“@”是“this”

....
          # the user has expanded a group, so check that we have parent node data...
          else if params.parentNode? and params.parentNode.data? and params.parentNode.expanded
            parentId = params.parentNode.data.id

            if @editionsDict[parentId]?
              params.successCallback(@editionsDict[parentId], @editionsDict[parentId].length)
            else
              # database call that returns a promise for when data is retrieved
              @gridLoadChildren(parentId).then((res) =>
                setTimeout(()=>
                  @editionsDict[parentId] = @childWorks
                  params.successCallback(@editionsDict[parentId], @editionsDict[parentId].length)
                ,0)
              )

@childWorks 填充在 @gridLoadChildren 中。除此之外,@gridLoadChildren 只是一个使用父 ID 执行select 的数据库调用。

【问题讨论】:

    标签: javascript coffeescript ag-grid


    【解决方案1】:

    不幸的是,我无法使用 Ag Grid 的行分组。在我开发这个功能的整个过程中,感觉就像我在与网格搏斗,并试图让它做一些它不应该做的事情。值得庆幸的是,我遇到了master/detail 文档,并且将转而采用这条路线。到目前为止,它完全可以满足我的需要(服务器端数据和仅扩展特定行的组)。

    【讨论】:

      猜你喜欢
      • 2017-06-11
      • 1970-01-01
      • 2016-06-22
      • 2021-12-08
      • 2021-11-09
      • 2021-06-16
      • 1970-01-01
      • 1970-01-01
      • 2019-01-13
      相关资源
      最近更新 更多