cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 How to Detect the user moving away from View

gary_king2
Participant
0 Kudos

Is there a specific UI5 related event or method to detect when the user moves away from a View, or changes view focus?

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor
0 Kudos

not sure about the view, but you can check by adding a browser event(method available for all ui5 controls to add a browser event).

the event will be mouseleave:

https://developer.mozilla.org/en/docs/Web/Events/mouseleave

maybe be try adding it for the sap.m.page..

Best Regards,
Mahesh

junwu
Active Contributor
0 Kudos

what's your point?

gary_king2
Participant
0 Kudos

I have two Views, with the first view containing a table, of which when a row is selected, navigation is done to move to the second view.

The second view can be bound to the global model using the XML, like so:<Table items="{GM>/Contact/Insurance}" ...

However, when inserting, deleting and editing the table, all the functionality of this is handled via functions within the View controller. Therefore, I believe I need to retrieve the data from the global model in the controller, Therefore create another model from this and bind it to the view table, and have the XML binding show <Table items="{/}"...

Is that correct?

If so, once I move away from this view, how do I put the data back in the global model, if I can't detect moving away from the view?.

junwu
Active Contributor
0 Kudos

not able to follow u 100%, but i think no need.