I have two issues with my listview which I would appreciate help with.
1) The listview takes a while to display (aprox 3 seconds). I navigate to the view that has the listview, the h1 of the view appears but it takes a while before the listview is displayed. This happens every time, not just the first time it is loaded.
2) I have added endlessScroll: true and scrollTreshold: 30 to my listview. This seems to display the data from the datasource in a continuous loop that never ends. Is this supposed to happen? I would only want to display the contents of the datasource once and not have this repeating.
I have the following code:
1) The listview takes a while to display (aprox 3 seconds). I navigate to the view that has the listview, the h1 of the view appears but it takes a while before the listview is displayed. This happens every time, not just the first time it is loaded.
2) I have added endlessScroll: true and scrollTreshold: 30 to my listview. This seems to display the data from the datasource in a continuous loop that never ends. Is this supposed to happen? I would only want to display the contents of the datasource once and not have this repeating.
I have the following code:
var DataSource = new kendo.data.DataSource({ pageSize: 5, transport: { read: "data.php", dataType: "json", }, error: function(e) { alert(e.responseText); }, sort: { field: "date", dir: "desc" }, schema: { model: { id: "id", fields: { item: { type: "string" }, date: { type: "date", "string" }, total:{ type: "string" }, status: { type: "string" }, isnew: { type: "string" }, dispatched: { type: "string" } } } } });<div data-role="view" id="list" data-init="listinit"> <h2>List</h2> <ul id="list"></ul> </div> <script id="list_template" type="text/x-kendo-template"> # if(status == 1){ var statusText = 'Open'; var statusColour = 'green'; } else if(status == 2) { var statusText = 'Closed'; var statusColour = 'blue'; } else { var statusText = 'Problem'; var statusColour = 'red'; } # <div style="font-size:70%;padding-right:10%"><div style="float:left;margin-right:3px;">ID. #= id#</div><div style="float:right;" >#= date #</div><div style="clear:both;text-align:center;padding: 0 5px;width: 60px;float:left;background-color:#= statusColour #; color: white;font-weight:bold">#= statusText #</div><div style="float:right;margin-right:3px;">Total: #= total #</div><div style="clear:both;"></div></div></a></script> <script> function listinit(){ $("#list").kendoMobileListView({ dataSource: DataSource, pullToRefresh: true, appendOnRefresh: false, style: "inset", endlessScroll: true, scrollTreshold: 30, //treshold in pixels template: $("#list_template").text() }); } </script>