Hello,
I'm using endless scrolling and pull-to-refresh in a list view. My DataSource contains a server-side sort on CreatedAt in descending order. Since newer records can NEVER have a CreatedAt with a value greater than a record created earlier in time, my listview is finite at the bottom, but infinite at the top. In other words, I need endless scrolling at the top of the listview, since new records will be sorted to the top of the list.
It sounds like the pull-to-refresh feature is what I need to find these new records. I'm having trouble getting it work, though, and need some advice.
I've gotten as far as getting my pullParameters function to be called, passing the data item that is currently at the top of the listview. I don't understand what I need to return in order for the refresh of the DataSource to occur. Here is how my data source is defined:
I've watched the Logs, and see that the pull-to-refresh callback is just repeating the last query made before the pull. For example, if I have scrolled to the bottom of the list of 100 records, it sends skip: 100 take: 20. All I want to do is have the pullParameters reset the skip to 0.
The pullParameters documentation says "The result of the function will be send as additional parameters to the DataSource's next method." I don't even see a "next" method in the DataSource doc. I don't see any point to sending "additional parameters" to Everlive for a straight query, and I checked the logs and don't see any parameters sent when I do return something from pullParameters. So instead of returning anything, I just add the following to my pullParameters function:
1) Now, I'm getting the result I want, but I don't think I'm doing it correctly and I'm afraid it will break. So, please - what do I need to return in pullParameters to reset the datasource to the top?
2) Also, is it possible to define pullParameters in the markup? I've tried data-pull-parameters, data-pullparameters, etc and can't get it to fire unless I call kendoMobileListView() directly.
Thank you,
Kelly
I'm using endless scrolling and pull-to-refresh in a list view. My DataSource contains a server-side sort on CreatedAt in descending order. Since newer records can NEVER have a CreatedAt with a value greater than a record created earlier in time, my listview is finite at the bottom, but infinite at the top. In other words, I need endless scrolling at the top of the listview, since new records will be sorted to the top of the list.
It sounds like the pull-to-refresh feature is what I need to find these new records. I'm having trouble getting it work, though, and need some advice.
I've gotten as far as getting my pullParameters function to be called, passing the data item that is currently at the top of the listview. I don't understand what I need to return in order for the refresh of the DataSource to occur. Here is how my data source is defined:
var
dataSource =
new
kendo.data.DataSource({
type:
'everlive'
,
transport: {
typeName:
'Test'
},
pageSize: 20,
serverPaging:
true
,
serverSorting:
true
,
sort: [
{ field:
'CreatedAt'
, dir:
'desc'
}
],
change:
function
(e) {
var
data =
this
.data();
console.log(
'First: '
+ data[0].Text +
' Last: '
+ data[data.length - 1].Text);
}
});
I've watched the Logs, and see that the pull-to-refresh callback is just repeating the last query made before the pull. For example, if I have scrolled to the bottom of the list of 100 records, it sends skip: 100 take: 20. All I want to do is have the pullParameters reset the skip to 0.
The pullParameters documentation says "The result of the function will be send as additional parameters to the DataSource's next method." I don't even see a "next" method in the DataSource doc. I don't see any point to sending "additional parameters" to Everlive for a straight query, and I checked the logs and don't see any parameters sent when I do return something from pullParameters. So instead of returning anything, I just add the following to my pullParameters function:
pullParameters:
function
(e) {
this
.dataSource.page(1);
}
1) Now, I'm getting the result I want, but I don't think I'm doing it correctly and I'm afraid it will break. So, please - what do I need to return in pullParameters to reset the datasource to the top?
2) Also, is it possible to define pullParameters in the markup? I've tried data-pull-parameters, data-pullparameters, etc and can't get it to fire unless I call kendoMobileListView() directly.
Thank you,
Kelly