Untitled
unknown
javascript
3 years ago
3.6 kB
3
Indexable
// Node Press Event oPageController.prototype.nodePress = function (oEvent) { var sSelectedNodeString = oEvent.getSource().getBindingContext().sPath; var nLastIndex = sSelectedNodeString.lastIndexOf('/'); var nSelectedNode = sSelectedNodeString.substring(nLastIndex + 1); var oNode = this._graph.getNodeByKey(oEvent.getSource().getBindingContext().oModel.oData.nodes[nSelectedNode].id); this._openDetail(oNode,oNode); }; // Get Custom Data oPageController.prototype._getCustomDataValue = function (oNode, sName) { var aItems = oNode.getCustomData().filter(function (oData) { return oData.getKey() === sName; }); return aItems.length > 0 && aItems[0].getValue(); }; // Launch Tooltip Fragment oPageController.prototype._openDetail = function (oNode, oButton) { // var sTeamSize = this._getCustomDataValue(oNode, "team"); if (!this._oQuickView) { Fragment.load({ // name: "sap.suite.ui.commons.sample.NetworkGraphOrgChart.TooltipFragment", name: "com.sap.ui5.chart.orgchart.TooltipFragment", type: "XML" }).then(function (oFragment) { this._oQuickView = oFragment; this._oQuickView.setModel(new JSONModel({ icon: oNode.getImage() && oNode.getImage().getProperty("src"), title: oNode.getDescription(), description: this._getCustomDataValue(oNode, "position"), location: this._getCustomDataValue(oNode, "location"), showTeam: !!sTeamSize, teamSize: sTeamSize, email: this._getCustomDataValue(oNode, "email"), phone: this._getCustomDataValue(oNode, "phone") })); setTimeout(function () { this._oQuickView.openBy(oButton); }.bind(this), 0); }.bind(this)); } else { this._oQuickView.setModel(new JSONModel({ icon: oNode.getImage() && oNode.getImage().getProperty("src"), title: oNode.getDescription(), description: this._getCustomDataValue(oNode, "position"), location: this._getCustomDataValue(oNode, "location"), showTeam: !!sTeamSize, teamSize: sTeamSize, email: this._getCustomDataValue(oNode, "email"), phone: this._getCustomDataValue(oNode, "phone") })); setTimeout(function () { this._oQuickView.openBy(oButton); }.bind(this), 0); } };
Editor is loading...