Skip to Content
0

View not re-rendered for second time using routing

Feb 15, 2017 at 05:41 PM

76

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Veeraraghavan Narasimhan
Feb 16, 2017 at 12:52 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 16, 2017 at 08:21 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 16, 2017 at 11:52 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded