cancel
Showing results for 
Search instead for 
Did you mean: 

How can i associate a view to each item in the toolheader ?

Hello everyone ,

have you any idea how can i move to another view when i click on an iconTabFilter in a toolheader .

PS: the toolheader is repeated in each view .

i have added the toolheader view in each other views as below :

But i didn't know how can i move to another view when i select an item :

View Entire Topic
0 Kudos

Hi Imen,

Please, try below solution.

In "onSelectTab" method in controller, add below code:

var key = oEvent.getSource().getSelectedKey();

if(key === "key1"){
this.getRouter().getTargets().display("subview1");
}
else if(key === "key2"){
this.getRouter().getTargets().display("subview2");
}
else{
this.getRouter().getTargets().display("subview3");
}

Make sure to add key attribute to <IconTabFilter>.

manifest.json:

Add below code in targets section

"targets": {
"TargetView1": {
"viewType": "XML",
"transition": "slide",
"clearControlAggregation": false,
"viewId": "MainView",
"viewName": "MainView",
"viewLevel": 1
},
"subview1": {
"viewType": "XML",
"viewId": "subView1",
"viewName": "View1",
"clearControlAggregation": false,
"parent": "TargetView1",
"controlId": "page"
"controlAggregation": "content"
"viewLevel": 2
},
"subview2": {
"viewType": "XML",
"viewName": "View2",
"parent": "TargetView1",
"controlId": "page"
"controlAggregation": "content"
"viewLevel": 2
},
"subview3": {
"viewType": "XML",
"viewName": "View3",
"viewId": "subView3",
"clearControlAggregation": false,
"parent": "TargetView1",
"controlId": "page"
"controlAggregation": "content"
"viewLevel": 2
}
}

In manifest, we specified that parent View would be TargetView1 and controlid is "page" and controlAggregation is "content". Now, when the user selects a tab controller searches for the control with ID "page" and <content> control inside it.

Please, keep in mind that Toolheader view should not contain Page or pages control as this would overlap the subviews. Also, You need to clear the contents of the subView container control as we are loading different views each time user any tab. to do this you can either set "clearControlAggregation": true in manifest file or clear the contents manually in mainView's controller.

Regards,

Venkatesh.

0 Kudos

Thank you for your answer :)))))) it works .