11-29-2012 11:36 PM
Is it possible to trap when a listview has scrolled to it's last item and emit a signal?
my content is loaded from a webservice that only ever returns 10 items at a time, and I'd rather not load the content if the user doesn't require it.
Ideas?
11-30-2012 12:21 AM
11-30-2012 01:47 AM
11-30-2012 05:12 AM
Hmmm, it's very coarse-grained indeed - scrolling, at beginning and at end.
Are there any other ways of looking at the state of the ListView?
I'd really like to implement a pull-to-refresh style mechanism - has anyone else tried that or got any ideas how best to go about it?
11-30-2012 11:37 AM
11-30-2012 12:43 PM
11-30-2012 01:25 PM
I'm trying to use this, however when I do the following within the QML I get the error:
ListView {
id: newsList
listItemComponents: [
NewsItem {
type: "News"
},
MoreItem {
type: "more"
}
]
layout: StackListLayout {
headerMode: ListHeaderMode.None
}
function itemType(data, indexPath) {
if (data.type == "News") {
return "News";
} else {
return "more";
}
}
attachedObjects: [
// This handler is tracking the scroll state of the ListView.
ListScrollStateHandler {
id: scrollStateHandler
onScrollingChanged: {
console.log("scollingggggg wheeee");
if (scrolling) {
console.log("Scrollinggggg wheeee");
} else {
console.log("Not scrolling");
}
if (atEnd) {
console.log("At the end");
}
}
objectName: "scrollListener"
}
]
}
ReferenceError: Can't find variable: atEnd
Thoughts?
11-30-2012 01:31 PM - edited 11-30-2012 04:02 PM
atEnd is only a variable in onAtEndChanged.
The only parameter available in onScrollingChanged is scrolling
11-30-2012 01:36 PM
11-30-2012 02:57 PM
I tried adding in the onAtEnd signal handler via QML and it's saying the signal is unknown...
ListView {
id: newsList
objectName: "newsList"
layoutProperties: StackLayoutProperties {
spaceQuota: 1
}
listItemComponents: [
NewsItem {
type: "News"
},
MoreItem {
type: "more"
}
]
layout: StackListLayout {
headerMode: ListHeaderMode.None
}
function itemType(data, indexPath) {
if (data.type == "News") {
return "News";
} else {
return "more";
}
}
attachedObjects: [
// This handler is tracking the scroll state of the ListView.
ListScrollStateHandler {
id: scrollStateHandler
onScrollingChanged: {
console.log("scollingggggg wheeee");
if (scrolling) {
console.log("Scrollinggggg wheeee");
} else {
console.log("Not scrolling");
}
if(scrollStateHandler.atEnd) {
console.log("end");
}
}
onAtEnd: {
if (atEnd) {
console.log("We're at the end");
}
}
objectName: "scrollListener"
}
]
}
as you can see I also tried to access the atEnd property within the onScrollingChanged signal but it's never reached either.
Do any of you happen to have a working example?