我只是将特定值的行分组。这是我的数据库结构的简化版本:
我在该行的项目类型为父项时进行分组。我为该行的子级执行数据库提取,并将其填充到行组中。
我最终遇到了一个非常奇怪的渲染问题:(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
的数据库调用。
[我发现我的代码实际上没有任何问题(感谢),但是这与Ag-Grid的材质主题有关。我已经切换到Balham,问题就消失了。