angular-ui/ui-grid

Importer Error(with rowEdit) - angular.min.js:108 requested row not found in rowEdit.setRowsDirty, row was: [object Object]

已關閉

#5,815 建立於 2016年11月15日

 (6 則留言) (2 個反應) (0 位負責人)JavaScript (2,496 個分叉)batch import
help wanted

倉庫指標

星標
 (5,395 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Implemented Importer functionality and everything works fine except when I get the following error on the console from adding new row to the grid on this line of code - allRows.unshift({

Error message: angular.min.js:108 requested row not found in rowEdit.setRowsDirty, row was: [object Object]

importerDataAddCallback: function (grid, newObjects) { var errorPRLS = ""; var errors = 0;

                if (newObjects) {                      
                    var cnt = newObjects.length;                
                    //turn on cancel button
                    grid.appScope.trigger.insert = true;
                    grid.appScope.trigger.importer = true;
                    var allRows = this.data;

                    angular.forEach(newObjects, function (row, index) {
                        PrecutReplenishmentService.requestId = row.precutPartNumber;
                        PrecutReplenishmentService.doGetMaster().success(function (response) {
                                if (response.data !== null) {
                                    if (typeof response.data.successful !== 'undefined' && !response.data.successful) {
                                        errorPRLS = errorPRLS == "" ? row.precutPartNumber : errorPRLS + ", " + row.precutPartNumber;
                                        errors++;
                                    } else {
                                            //instantiate local object
                                            var pRLColorDetail = new Object();
                                            pRLColorDetail.id = grid.appScope.prlColors[grid.appScope.trigger.setColorIndex].id;
                                            pRLColorDetail.pRLColor = grid.appScope.prlColors[grid.appScope.trigger.setColorIndex].pRLColor;
                                            //add to the top of collection
                                            allRows.unshift({
                                                id: 0,
                                                pRLColorId: grid.appScope.prlColors[grid.appScope.trigger.setColorIndex].id, //default data entity row to yellow
                                                pRLColorDetails: pRLColorDetail, //default data editor to yellow
                                                precutPartNumber: row.precutPartNumber,
                                                piecesToCut: row.piecesToCut,
                                                masterPartNumber: response.data.precutMaster,
                                                isDrill: response.data.isDrill,
                                                scheduledCutDate: grid.appScope.getCutDate()
                                            });
                                            //add to save counter
                                            grid.appScope.trigger.records++;
                                            //fire after all promisses have been resolved
                                            if (grid.appScope.trigger.records > 0) {
                                                if (cnt == grid.appScope.trigger.records + errors) {
                                                    $interval(function () {
                                                         var gridRows = grid.rows.filter(function (element) { return element.entity.id == 0 });
                                                         var dataRows = gridRows.map(function (gridRow) { return gridRow.entity; });
                                                         grid.api.rowEdit.setRowsDirty(dataRows); 

貢獻者指南