在rappid js中仅更新一次后端

时间:2019-01-31 08:11:08

标签: javascript rappid

我遇到了一个问题,当删除带有两个链接的节点时,我会得到三个更新,但是我只希望后端有一个更新

graph.on("remove", function(cell, collection, opt) {
                            if (!_.isUndefined($scope.isClear) && $scope.isClear === true) {
                                return;
                            }

                            if (cell.attributes.type !== "link") {
                                $scope.isDirty = true;
                                convertFromRappidJsGraph(collection.graph);
                                $scope.processesGraph = JSON.stringify($scope.goJsGraphData);
                                logger.info('cell removed' + cell.id);
                                //return;
                            }  if ((cell.attributes.type === "link") && (cell.attributes.source.id) && (cell.attributes.target.id) && ($scope.showLinkVertices === false)) {
                                $scope.isDirty = true;
                                convertFromRappidJsGraph(collection.graph);
                                $scope.processesGraph = JSON.stringify($scope.goJsGraphData);
                                logger.info('link removed');
                            }
                        }, this);

我试图从删除单元格条件中返回,但它不起作用 我尝试了这种方式来获取连接的链接并将其删除。

// if(graph.getConnectedLinks(cell.id)>1){
                            //     $scope.isDirty = true;
                            //     convertFromRappidJsGraph(collection.graph);
                            //     $scope.processesGraph = JSON.stringify($scope.goJsGraphData);
                            //     logger.info('cell removed' + cell.id);
                            // }

这种方式也行不通 您可以在下面的图像中找到删除单元格前后的更新。 enter image description here

删除起始节点后,它将对后端进行3次更新,其中一个是单元和两个链接。

enter image description here

但是我只希望一个后端更新。

0 个答案:

没有答案