Hi,
after hours of banging my head on this problem, I finally found the solution.
I'm posting it here in case someone comes across the same issue.
Solution:
the trick is not to use the "pull to refresh" widget of the listview, but instead these of the view. Then in the initialization of the view you define the pull function that is going to refresh the listview's source of the view-model.
Let me post my code to make things more clear.
View:
01.
<
div
data-role
=
"view"
id
=
"ListSPItems"
data-init
=
"ViewInit"
data-title
=
"Customers List"
data-layout
=
"mobile-tabstrip"
>
02.
<
div
id
=
"CustomersError"
/>
03.
<
button
id
=
"create"
data-bind
=
"click: ClickCustomers"
class
=
"k-button"
>Add</
button
>
04.
05.
<
ul
id
=
"listview"
data-bind
=
"source: GetCustomers"
data-template
=
"itemTemplate"
></
ul
>
06.
07.
<
script
id
=
"itemTemplate"
type
=
"text/x-kendo-template"
>
08.
<!--<li><a> ${data.Title} </a></li>-->
09.
<
li
><
a
class
=
"km-listview-link"
data-role
=
"listview-link"
> ${data.Title} </
a
></
li
>
10.
</
script
>
11.
</
div
>
View-Model:
01.
var
VMListSPItems = kendo.observable({
02.
03.
// Hold SharePoint list items
04.
GetCustomers:
function
(e)
05.
{
06.
var
Customers = GetAllCustomers(SPSite);
07.
Customers.success(
function
(data){
08.
// Get Value from SharePoint
09.
var
AllCustomers =
null
;
10.
AllCustomers = data.d.results;
11.
12.
// Update data
13.
VMListSPItems.set(
"GetCustomers"
, AllCustomers);
14.
});
15.
},
16.
17.
ClickCustomers :
function
(e)
18.
{
19.
var
Customers = GetAllCustomers(SPSite);
20.
Customers.success(
function
(data){
21.
// Get Value from SharePoint
22.
var
AllCustomers =
null
;
23.
AllCustomers = data.d.results;
24.
25.
// Update data
26.
VMListSPItems.set(
"GetCustomers"
, AllCustomers);
27.
});
28.
},
29.
});
30.
31.
32.
// Initialize the scroller on the view
33.
function
ViewInit(e)
34.
{
35.
var
scroller = e.view.scroller;
36.
37.
scroller.setOptions({
38.
pullToRefresh:
true
,
39.
pull:
function
(){
40.
var
Customers = GetAllCustomers(SPSite);
41.
Customers.success(
function
(data){
42.
// Get Value from SharePoint
43.
var
AllCustomers =
null
;
44.
AllCustomers = data.d.results;
45.
46.
// Update data
47.
VMListSPItems.set(
"GetCustomers"
, AllCustomers);
48.
});
49.
50.
setTimeout(
function
() { scroller.pullHandled(); }, 400);
51.
}
52.
})
53.
}