Javascript ui网格有重复的行

Javascript ui网格有重复的行,javascript,angularjs,google-chrome,ui-grid,Javascript,Angularjs,Google Chrome,Ui Grid,我不知道这是怎么开始的,但我的页面上的ui网格(angular SPA)不知怎么地复制了2行(我不希望这样) 刷新页面(Chrome)没有效果(我打开了devtools,选中了Disable cache) 仅供参考:我正在将grid.data设置为一个包含65个实体的数组,这样计数是正确的,如果我删除所有过滤器,它将显示所有65行,但实际上显示67行(我花了时间进行计数,有趣的是,在上下滚动时,交替行不一定保持灰色或白色) 这是我看到的。如果单击第3行或第4行,将同时选中这两行,而取消选中第1行

我不知道这是怎么开始的,但我的页面上的ui网格(angular SPA)不知怎么地复制了2行(我不希望这样)

刷新页面(Chrome)没有效果(我打开了devtools,选中了Disable cache)

仅供参考:我正在将grid.data设置为一个包含65个实体的数组,这样计数是正确的,如果我删除所有过滤器,它将显示所有65行,但实际上显示67行(我花了时间进行计数,有趣的是,在上下滚动时,交替行不一定保持灰色或白色)

这是我看到的。如果单击第3行或第4行,将同时选中这两行,而取消选中第1行和第2行。我假设它们具有相同的生成Id。请注意,这里确实表示只选择了一行,但显示了4行!

我可以在Firefox中打开该页面并登录,然后转到该页面,该页面看起来是正确的,因此它要么是Chrome中的某个页面,要么是这个实例中的某个页面,其他用户不会看到它。

以下是grid.data中的数组:

[{"Name":"Trainer","Desc":"","Type":"string","OptionsCount":6,"$$hashKey":"uiGrid-000W"},
{"Name":"System","Desc":"Practice","Type":"string","OptionsCount":97,"$$hashKey":"uiGrid-000Y"},
{"Name":"EMR","Desc":"Electronic","Type":"string","OptionsCount":67,"$$hashKey":"uiGrid-0010"},
{"Name":"Guideline","Desc":"Guideline","Type":"string","OptionsCount":7,"$$hashKey":"uiGrid-0012"},
{"Name":"Notes","Desc":"Notes","Type":"string","OptionsCount":4,"$$hashKey":"uiGrid-0014"},
{"Name":"Scorecard","Desc":"April 2015","Type":"string","OptionsCount":27,"$$hashKey":"uiGrid-0016"},
{"Name":"Scorecard","Desc":"July 2015 ","Type":"string","OptionsCount":27,"$$hashKey":"uiGrid-0018"},
{"Name":"Scorecard","Desc":"November 2","Type":"string","OptionsCount":27,"$$hashKey":"uiGrid-001A"},
{"Name":"Scorecard","Desc":"December 2","Type":"string","OptionsCount":27,"$$hashKey":"uiGrid-001C"},
{"Name":"Scorecard","Desc":"September ","Type":"string","OptionsCount":27,"$$hashKey":"uiGrid-001E"},
{"Name":"2012","Desc":"","Type":"money","$$hashKey":"uiGrid-001G"},
{"Name":"2014","Desc":"","Type":"money","$$hashKey":"uiGrid-001I"},
{"Name":"2015","Desc":"","Type":"money","$$hashKey":"uiGrid-001K"},
{"Name":"2016","Desc":"","Type":"money","$$hashKey":"uiGrid-001M"},
{"Name":"2017","Desc":"","Type":"money","$$hashKey":"uiGrid-001O"},
{"Name":"Specialty","Desc":"Primary","Type":"string","OptionsCount":191,"$$hashKey":"uiGrid-001Q"},
{"Name":"Specialty2","Desc":"Secondary","Type":"string","OptionsCount":191,"$$hashKey":"uiGrid-001S"},
{"Name":"Special","Desc":"Special","Type":"string","$$hashKey":"uiGrid-001U"},
{"Name":"Rooming In","Desc":"Rooming in","Type":"date","$$hashKey":"uiGrid-001W"},
{"Name":"HTN","Desc":"Hyper","Type":"date","$$hashKey":"uiGrid-001Y"},
{"Name":"Depression","Desc":"Depression","Type":"date","$$hashKey":"uiGrid-0020"},
{"Name":"Measure","Desc":"measure","Type":"date","$$hashKey":"uiGrid-0022"},
{"Name":"HCC","Desc":"HCC","Type":"date","$$hashKey":"uiGrid-0024"},
{"Name":"Data 1","Desc":"First","Type":"date","$$hashKey":"uiGrid-0026"},
{"Name":"Data 2","Desc":"Second","Type":"date","$$hashKey":"uiGrid-0028"},
{"Name":"Data 3","Desc":"Third","Type":"date","$$hashKey":"uiGrid-002A"},
{"Name":"Term Date","Desc":"Termination","Type":"date","$$hashKey":"uiGrid-002C"},
{"Name":"2015.11","Desc":"11.1.2015","Type":"float","$$hashKey":"uiGrid-002E"},
{"Name":"2016.07","Desc":"7.1.2016","Type":"float","$$hashKey":"uiGrid-002G"},
{"Name":"Status","Desc":"Practice","Type":"string","OptionsCount":3,"$$hashKey":"uiGrid-002I"},
{"Name":"Phase","Desc":"","Type":"string","OptionsCount":5,"$$hashKey":"uiGrid-002K"},
{"Name":"EMFMT","Desc":"","Type":"string","OptionsCount":2,"$$hashKey":"uiGrid-002M"},
{"Name":"LAB Data","Desc":"","Type":"string","OptionsCount":2,"$$hashKey":"uiGrid-002O"},
{"Name":"Phase #","Desc":"Performance","Type":"integer","$$hashKey":"uiGrid-002Q"},
{"Name":"Letter 1","Desc":"Performance","Type":"date","$$hashKey":"uiGrid-002S"},
{"Name":"Letter 2","Desc":"Performance","Type":"date","$$hashKey":"uiGrid-002U"},
{"Name":"Letter 3","Desc":"Performance","Type":"date","$$hashKey":"uiGrid-002W"},
{"Name":"I Term","Desc":"","Type":"date","$$hashKey":"uiGrid-002Y"},
{"Name":"CO","Desc":"CO","Type":"bit","$$hashKey":"uiGrid-0030"},
{"Name":"Chart","Desc":"Chart","Type":"string","OptionsCount":3,"$$hashKey":"uiGrid-0032"},
{"Name":"Test money","Desc":"","Type":"money","$$hashKey":"uiGrid-0034"},
{"Name":"End-testing","Desc":"","Type":"money","$$hashKey":"uiGrid-0036"},
{"Name":"test1234","Desc":"","Type":"string","OptionsCount":5,"$$hashKey":"uiGrid-0022"},
{"Name":"testAbc","Desc":"","Type":"date","$$hashKey":"uiGrid-003A"},
{"Name":"test456","Desc":"","Type":"bit","$$hashKey":"uiGrid-003C"},
{"Name":"M","Desc":"Meaningful","Type":"string","OptionsCount":2,"$$hashKey":"uiGrid-003E"},
{"Name":"test date","Desc":"","Type":"date","$$hashKey":"uiGrid-003G"},
{"Name":"Service","Desc":"","Type":"string","$$hashKey":"uiGrid-003I"},
{"Name":"R Notes","Desc":"","Type":"string","OptionsCount":17,"$$hashKey":"uiGrid-003K"},
{"Name":"Appointment","Desc":"Appointment","Type":"string","OptionsCount":3,"$$hashKey":"uiGrid-003M"},
{"Name":"Connection","Desc":"Type of Connection","Type":"string","OptionsCount":6,"$$hashKey":"uiGrid-003O"},
{"Name":"A","Desc":"","Type":"string","OptionsCount":6,"$$hashKey":"uiGrid-003Q"},
{"Name":"Billing","Desc":"B","Type":"string","OptionsCount":6,"$$hashKey":"uiGrid-003S"},
{"Name":"E Connection","Desc":"","Type":"string","$$hashKey":"uiGrid-003U"},
{"Name":"Addend","Desc":"Data Addend","Type":"string","OptionsCount":2,"$$hashKey":"uiGrid-003W"},
{"Name":"IT","Desc":"","Type":"string","OptionsCount":4,"$$hashKey":"uiGrid-003Y"},
{"Name":"Portal","Desc":"","Type":"string","OptionsCount":5,"$$hashKey":"uiGrid-0040"},
{"Name":"Follow-up ","Desc":"","Type":"string","OptionsCount":3,"$$hashKey":"uiGrid-0042"},
{"Name":"Subspecial","Desc":"","Type":"string","OptionsCount":4,"$$hashKey":"uiGrid-0044"},
{"Name":"T","Desc":"Trainerh","Type":"string","$$hashKey":"uiGrid-0046"},
{"Name":"S","Desc":"","Type":"string","OptionsCount":3,"$$hashKey":"uiGrid-0048"},
{"Name":"A","Desc":"Date","Type":"string","$$hashKey":"uiGrid-004A"},
{"Name":"Dual","Desc":"Date joint","Type":"date","$$hashKey":"uiGrid-004C"},
{"Name":"Start D","Desc":"","Type":"date","$$hashKey":"uiGrid-004E"},
{"Name":"CO Addend","Desc":"Data COA","Type":"string","OptionsCount":1,"$$hashKey":"uiGrid-004G"}]
还有其他人在ui网格中遇到过这个问题吗?您是如何解决的?
或者有人能解释为什么要创建这些额外的行,并且始终只为这两行创建吗?

好的,下面是我的答案。很抱歉,这并不是原始问题的全部内容,但代码太多,无法提供帮助。我写这个答案是为了帮助其他遇到类似问题并陷入调试困境的人(因为我认为共享是这样做的目的)

对于后台,如果url具有行的Id作为参数,则应在页面加载过程中选择该行

在代码中,数据被加载到grid.data中。然后,如果url具有参数,则在grid.data上执行循环以查找匹配的行。如果找到了,它就会调用

gridApi.grid.modifyRows(grid.data).then(action);
这里的动作会是什么样的

$timeout(function () {
    // Do this after the columns and rows processors have finished and it is all rendered.
    selectRows.forEach(function (row) {
        gridApi.selection.selectRow(row);
    });
    gridApi.core.scrollTo(selectRows.pop(), grid.columnDefs[0]);
}, 100);

现在对我有效的是跳过“gridApi.grid.modifyRows”并只调用该操作。我认为,如果在检索数据并将其分配给grid.data之前已经呈现了网格,那么代码之前就已经在那里更新了网格,但这是通过等待onRegisterApi触发,然后分配grid.data来完成的。

如果您对该问题有疑问,请解释一下,问题是什么,并在向下投票前提出改进建议:(我检查了,有两行被选中,它们有不同的GridRow.uid,但名称相同。你能发布一些代码吗?你的列表,你的网格定义我把它缩小到这个调用:gridApi.grid.modifyRows(grid.data)。然后(操作).如果我这样评论,这里的问题就消失了.酷.你也可以创建一个指令来执行所有绑定.我对复制记录也有同样的问题,但不理解你的解决方案。