on 04-06-2020 3:28 PM
Hi All,
I am using Network Graph control with OData model bindings and it works well. I added a custom action button of 'Delete' on Nodes which trigger DELETE call to SAP to delete that node. With the delete call, OData model automatically fetches the Nodes again and it crashes the Graph at this point. I get duplicate ID error in my console.
Could someone please help me here?
BR, Ekansh
I just removed the custom action buttons from XML view and added those in controller inside AfterLayouting event handler function and it works.
onAfterLayouting: function (oGraph) {
this.oGraph.preventInvalidation(true);
var aNodes = oGraph.getNodes() || [];
//add action buttons per NodeType
for (var i = 0; i < aNodes.length; i++) {
var oNode = aNodes[i];
switch (oNode.getBindingContext().getProperty("NodeType")) {
case "PARTNER":
//detail button
oNode.addActionButton(new ActionButton({
icon: this._teamViewModel.getProperty("/detailBtnIcon"),
title: this.getText("Tooltip.Details"),
tooltip: this.getText("Tooltip.Details"),
press: function (oEvent) {
this.onPressNodeDetail(oEvent);
}.bind(this)
}));
//delete button
oNode.addActionButton(new ActionButton({
icon: this._teamViewModel.getProperty("/deleteBtnIcon"),
title: this.getText("Tooltip.Delete"),
tooltip: this.getText("Tooltip.Delete"),
press: function (oEvent) {
this.onPressNodeDelete(oEvent);
}.bind(this)
}));
break;
case "PROJECT":
//add partner button
oNode.addActionButton(new ActionButton({
icon: this._teamViewModel.getProperty("/addBtnIcon"),
title: this.getText("Tooltip.AddPartner"),
tooltip: this.getText("Tooltip.AddPartner"),
press: function (oEvent) {
this.onPressAddPartner(oEvent);
}.bind(this)
}));
break;
case "PRODUCT":
//add partner button
oNode.addActionButton(new ActionButton({
icon: this._teamViewModel.getProperty("/addBtnIcon"),
title: this.getText("Tooltip.AddPartner"),
tooltip: this.getText("Tooltip.AddPartner"),
press: function (oEvent) {
this.onPressAddPartner(oEvent);
}.bind(this)
}));
break;
default:
}
}
this.oGraph.preventInvalidation(false);
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.