cancel
Showing results for 
Search instead for 
Did you mean: 

View not re-rendered for second time using routing

gowrinath_gundu
Participant
0 Kudos

Hello Everyone,

I am using a split app control where I have one master view and two detail views. I configured the manifest.json file for this. First detail view contains a table control to hold the line items. Second detail view contains the simple form with some fields which I use in line item.

My requirement is like, upon click of add button on first detail view I am displaying the second view (using routing), here I will fill my line item details and click on submit. Then this line item details should be added to table control in first detail screen.

Here I am facing two issues.

Issue#1 : To bind the data from second view to table control in first view,none of the view event handler functions(onBeforeRendering, onAfterRendering) are getting triggered in first detail screen after I click submit button on second detail screen.

Issue#2: Second detail view's view event handler functions are called only for the first time I call this using add button on first detail screen. For the subsequent calls none of the event handler functions are triggered. Because of this I can still see the previous call data on screen. I tried setting clearTarget to true in manifest.json but it doesn't help.

Your answers are much appreciated.

Regards,

Gowrinath

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Gowrinath,

Please try below code:

onInit() function write below code:

this._oRouter = sap.ui.core.UIComponent.getRouterFor(this);

this._oRouter.attachRouteMatched(this._handleRouteMatched, this);

// after that create new function:

_handleRouteMatched: function() {

// here you need to write code of table that you bind to your first view.

}

Hope this will help you!!!!

Regards,

Mahesh Phajage

gowrinath_gundu
Participant
0 Kudos

Hello Veera,

Thank you for looking into it.

I already tried writting the binding code(oTab.bindItems) in the AttachPatternMatched event handler function. But records are not binded. I am not sure of the reason for it.Can you help.

Also can you please eloborate me the purpose of clearTarget in manifest.json

Regards,

Gowrinath

former_member228602
Contributor
0 Kudos

Hello Gowrinath,

You are kind of try to follow the web-dynpro based approach of try using the hook methods. With routing in place the re-render does not necessarily happen. But there are other way to handle by using hook methods during navigation. The route themselves have events that you can listen to

You will find the event here Routes . Use AttachPatternMatched, AttachMatched based on your needs.

A usage in code is as shown in the link Examples

Hope this helps.

Thanks and Regards,

Veera