SAPUI5 why is the global BusyIndicator hiding too early? - sapui5

I've shown my BusyIndicator in the routeMatched() function
sap.ui.core.BusyIndicator.show();
Later on, this is hidden after I set the page to visible again.
...
...
...
self.getView().byId("Page1").setVisible(true);
sap.ui.core.BusyIndicator.hide();
The issue is: Because the view is shown again soon after, the indicator is hidden again, however, on a slower mobile, the page is in the process of rendering AFTER hiding the Indicator.
I need the view completely hidden until it's finished loading..
Any ideas?

The solution was to use sap.m.busyIndicator as opposed to sap.ui.core.BusyIndicator.

If your application is loading data before rendering, hide the busyIndicator in the success method of your AJAX requests.
If you are using oData Model, attach a listener to the batchRequestCompleted event of the oData Model and hide the BusyIndicator when the event is fired.
This should optimize the behavior on a mobile device.
Because of the asynchronous behavior of the SAPUI5 framework of rendering elements depending on the received data, it can be that some UI elements are still rendering, although the page is already visible.

Related

How to calculate page loading time in Ionic 3 (single page app)?

I am creating a function that calculates a page loading time for each page of my Ionic 3 App (I use lazy loading). However, I am currently stuck in issues:
When does the page start creating HTML?
When does the page finish creating HTML?
When does the page complete downloading all resources on the page (image, etc …)?
Can anyone give me advice?
One thing to look at is https://blog.ionicframework.com/navigating-lifecycle-events/ this contains the ionic life-cycle eg. ionViewDidLoad(): Fired only when a view is stored in memory. This event is NOT fired on entering a view that is already cached. It’s a nice place for init related tasks.
Ionic 3's pages are also angular components so I'd imagine the another thing to look at is the component hooks. These methods are fired when in the stages of the component life cycle.
https://angular.io/guide/lifecycle-hooks
https://www.intertech.com/Blog/angular-component-lifecycle/
eg. ngAfterViewInit(){ stopTimer() } //this method is fired once Angular initializes component and child component content
To achive what you want you could have a provider that both pages link to. When you change page start a timer and stop it using ngAfterViewInit() or other more appropriate hook.

Ionic- need an event after page is backed

I need an event of page which is backed.
IonWillEnter or ionViewDiEnter events aren't fired when page is backed.
Ionic framework seems to show page simply when a back button is clicked.
Would you like to teach me?
Sorry for my poor English.
Thanks
For your info.. Ionic 2 lifecycle method
ionViewDidLoad - works the same way as ngOnInit, fires once when the view is
initially loaded into the DOM
ionViewWillEnter and ionViewDidEnter - hooks that are available before and after the page becomes active
ionViewWillLeave and ionViewDidLeave - hooks that are available before and after the page leaves the viewport
ionViewWillUnload - is available before the page is removed from the DOM
You should use ionViewWillLeave / ioniViewDidLeave to track the page back/close event
According to https://ionicframework.com/blog/navigating-lifecycle-events/
ionViewWillEnter: It’s fired when entering a page, before it becomes the active one. Use it for tasks you want to do every time you enter in the view (setting event listeners, updating a table, etc.).
ionViewDidEnter: Fired when entering a page, after it becomes the active page. Quite similar to the previous one.
So you can use any of above. I prefer ionViewDidEnter more in this scenario so screen render faster if you call any API.

Best place to load data from service in xamarin forms MVVM

What is the best place to call a service and load data in xamarin forms
Till now I am calling the service in the view model constructor and loading data
I have a new situation -
In my app I check for network connectivity, if it's not connected to internet I will not load data in the main form and show a modal form saying network is not available check. If the recheck is success will pop the modal but as the data is not loaded the main form is empty.
So in this case I have to write service call in on appearing override function. Which gets called after the modal popped. Which is okay. But problem is every time when we navigate to that view it will make a service call.
Please guide me the best place to call these services
For your problem, you can use C# Events (Publisher-Subscriber) as the solution
Write a event called InternetDisconnectedEvent in the View Model. Subscribe to that event in Code behind of the View (.xaml.cs)
Make UI Changes in the View, when internet disconnected.
For more about Event & Delegates, check this tutorial
"...But problem is every time when we navigate to that view it will make a service call."
Create a flag (a boolean property), say IsLoaded in the viewmodel (or view, depending on your current implementation), that set to false initially. Then add a logic that check IsLoaded flag before calling the service. If IsLoaded is false, run your current logic of checking internet connection, calling service, so on.. and lastly update IsLoaded to true.

Wicked page flash when using Ajax

I start a thread from wicket and refresh a page every 5 secondes to check if the computed data are available. when it's the case, the result is displayed.
The problem is that the page flash every 5 secondes. with firebug, I found the xml response is
<ajax-response></ajax-response>
I use the AbstractDefaultAjaxBehavior and AbstractBehavior to use Ajax and I'm using wicket 1.4.9.
That flash is your page refreshing. You might want to change the behavior from refreshing the page to refreshing the component, that will be displaying the computed data. As long as there is no data or the component isn't visible there will be no noticeable flashing.

TinyMCE inside Durandal widget - callback after routing transition?

I'm trying to use TinyMCE in a widget but it fails. I think the problem is that view is still hidden when "viewAttached" is fired. It seems that TinyMCE has a bug/feature (read last paragraph) and can't be displayed when the target (textarea) is hidden (or inside a hidden div).
I got it working by doing the job in a setTimeout but it's crappy.
Is there a callback that I could attached to which is fired after the view is unhided (after the transition is completed)?
I found one solution:
Explicitly subscribe to the "isNavigating" observable of the router and add TinyMCE when "isNavigating" value becomes false.
Still : this has the effect of flickering - you see the textarea and then it is replaced by TinyMCE... but this is not a Durandal problem IMO.
Edit 1
Finally, I think the the best solution (for now... follow the link below for the thread on the subject) is to do a setTimeout(xyz(), 0) - I have seen a lot of people using this technique and it prevents the flickering.
https://groups.google.com/forum/?fromgroups#!topic/durandaljs/5NpSwMBnrew
Durandal does have a callbacks when you're using composition - you just put a function on to your viewModel with the correct name. In your case, you would use viewAttached:
Here's the docs:
http://durandaljs.com/documentation/Interacting-with-the-DOM/