OK. I usually do my listviews manually (clearing and appending items from ajax results) but I really want to get endless scrolling working so i've been banging my head against the wall trying to get a very very simple example working with no success.
Here is the HTML:
As you can see its a simple html view with a UL inside it. Now for my JS
So in the init, its suppose to initialize the listview and pull from my php script which returns JSON. I know my service is serving up the data as you can do an alert in the data handler and see the object it returns, in addition im emailing myself in the service the results anytime a request is made.
Here is example output from my service:
As you can see its a simple object with a result value that is an array of objects each containing a name key.
The result I am getting is a javascript alert and then only a single item is in the listview
"TypeError: 'undefined' is not a function (evaluating 'n.getAttribute(\"data-\"+dt.ns+\"role\")')"..... yadda yadda in kendo.mobile.minjs
Any help would be most appreciated. I've gone down every google search and avenue i can think of. I've used only the data-attributes instead of the js initialization, etc. All with no success.
Thanks!
Here is the HTML:
<
div
id
=
"test-view"
data-role
=
"view"
data-title
=
"Test"
data-layout
=
"default-layout"
data-init
=
"app.test.init"
data-show
=
"app.test.showView"
>
<
ul
id
=
"test-list"
class
=
"ul-content"
data-role
=
"listview"
>
</
ul
>
</
div
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"endless-scrolling-template"
>
<
li
>#: name#</
li
>
</
script
>
As you can see its a simple html view with a UL inside it. Now for my JS
(
function
(global) {
var
app = global.app = global.app || {};
app.test = {
init:
function
(e) {
$(
"#test-view ul#test-list"
).kendoMobileListView({
dataSource:
new
kendo.data.DataSource({
type:
"json"
,
serverPaging:
true
,
pageSize: 50,
transport: {
read: {
dataType:
"json"
}
},
schema: {
type:
"json"
,
data:
function
(data) {
return
data.result;
},
total:
function
(data) {
return
data.total;
}
}
}),
template: $(
"#endless-scrolling-template"
).text(),
endlessScroll:
true
});
},
showView:
function
(e) {
$(
"#loading-overlay"
).show();
app.application.showLoading();
setTimeout(
function
() {
$(
"#loading-overlay"
).hide();
app.application.hideLoading();
}, 2000);
e.view.scroller.reset();
}
};
})(window);
So in the init, its suppose to initialize the listview and pull from my php script which returns JSON. I know my service is serving up the data as you can do an alert in the data handler and see the object it returns, in addition im emailing myself in the service the results anytime a request is made.
Here is example output from my service:
{
"result"
:[{
"name"
:
"Item 1"
},{
"name"
:
"Item 2"
},{
"name"
:
"Item 3"
},{
"name"
:
"Item 4"
},{
"name"
:
"Item 5"
},{
"name"
:
"Item 6"
},{
"name"
:
"Item 7"
},{
"name"
:
"Item 8"
}],
"total"
:8}
As you can see its a simple object with a result value that is an array of objects each containing a name key.
The result I am getting is a javascript alert and then only a single item is in the listview
"TypeError: 'undefined' is not a function (evaluating 'n.getAttribute(\"data-\"+dt.ns+\"role\")')"..... yadda yadda in kendo.mobile.minjs
Any help would be most appreciated. I've gone down every google search and avenue i can think of. I've used only the data-attributes instead of the js initialization, etc. All with no success.
Thanks!