I have a view with tiles, each of which has a property id="foo"and a property of the press, indicating a function in the controller.
The problem is that I can get a fragment identifier, but it is automatically added to the view name __xmlview1--foo1. This may change if other views are already created; there is no guarantee that there will always be xmlview1, it can be xmlview2 or any larger number.
How to get a clean identifier, as it appears in the tile id property? Is this switch statement a better way to navigate, or is there a more robust / elegant solution?
onPress: function(oEvent){
switch(oEvent.getSource().sId) {
case "__xmlview1--foo1":
this.oRouter.navTo("myview1");
break;
case "__xmlview1--foo2":
this.oRouter.navTo("myview2");
break;
case "__xmlview1--foo3":
this.oRouter.navTo("myview3");
break;
case "__xmlview1--foo4":
this.oRouter.navTo("myview4");
break;
case "__xmlview1--foo5":
this.oRouter.navTo("myview5");
break;
default:
console.log("No match found.");
}
source
share