A helper item for handling data reload actions as soon as the item becomes visible. More...
Import Statement: | import Felgo 4.0 |
Inherits: |
This item is a convenience item that can be added as the header or footer of an AppListView.
As soon as the item gets visible within the AppListView the refresh signal is emitted. It's then possible to take appropriate actions in your app logic. This can be used to implement infinite scrolling for apps showing a news stream or similar data.
As an example you can load the next 20 tweets in your Twitter app as soon as a user scrolls to the bottom of the feed, as shown in the following sample:
import Felgo AppListView { footer: VisibilityRefreshHandler { onRefresh: twitterCient.loadNextTweets() } }
After all elements are displayed in a list and there is no new additional data you might want to show, set canRefresh to false
to prevent showing
the item any longer. If your app supports true "inifite scrolling", you can keep the default value for canRefresh (true
).
The default height is 48dp
and the default width is the parent width. If the VisibilityRefreshHandler is invisible, its size is set to 0
.
An AppActivityIndicator is displayed by default during the refresh.
To set a custom Item instead of the default delegate, see this example:
import QtQuick import Felgo AppListView { footer: VisibilityRefreshHandler { // disable the default view defaultAppActivityIndicatorVisible: false Rectangle { anchors.fill: parent color: "grey" Text { text: "Refreshing ..." anchors.centerIn: parent } } onRefresh: twitterClient.loadNextTweets() } }
[since Felgo 2.17.1] canRefresh : bool |
Use this property to control if the item should be shown or not within the contained AppListView.
By default the property is true
. Set to false
as soon as there is no more data you can load or show.
Note: Setting this property has the same effect as setting the item's Item::visible property. If the items is set to invisible, canRefresh
is also set to false
.
This property was introduced in Felgo 2.17.1.
[since Felgo 2.6.1] defaultAppActivityIndicatorVisible : bool |
Holds whether the default AppActivityIndicator shall be visible. By default it is true
.
Set this property to false to Customize the Delegate.
This property was introduced in Felgo 2.6.1.
listView : ListView |
The AppListView this item belongs to. This property is set automatically to the parent as soon as the item gets set as the header or footer of an AppListView.
refresh() |
Emitted as soon as the item is visible due to scrolling to the very top or bottom in the contained AppListView. You can take appropriate actions to handle the data reload or load more items for your list.
Note: The corresponding handler is onRefresh
.
See also canRefresh.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: