Hi,
I´d like to develop a mobile app with telerik platform / appbuilder in cordova by using visual Studio 2015.
The app connects to a web api over json and uses the Kendo datasource object with offlineStorage.
So far everything is okay switching beetween online and offline connection in the simulator or in the companoin app on my iPhone.
The problem is that I can't succed in using the offline datasource when opening the app after completely closing it before.
(offline Storage was already writen - not the very first start of the app)
I followed this article http://developer.telerik.com/featured/adding-offline-support-kendo-ui-mobile-app
and also this forum post http://www.telerik.com/forums/offline-storage-sync
I've got this code in my view.html:
<ul id="list" data-click="selectItem" data-auto-bind="false" data-source="dataSource" data-role="listview" data-template="contactsTemplate" ></ul><script type="text/x-kendo-template" id="contactsTemplate"> <span style="font-size:medium">#: data.such_Match #</span> - <span style="font-size:smaller">#: data.ort #</span></script>
And here is my JavaScript file:
'use strict';app.auftraegeView = kendo.observable({ onShow: function () {}, afterShow: function () {}});app.localization.registerView('auftraegeView');// START_CUSTOM_CODE_homeView// Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changesvar crudServiceBaseUrl = "http://komserver.mnc-tec.de:9810/api";var dataSource = new kendo.data.DataSource({ offlineStorage: "Offline", transport: { read: { url: crudServiceBaseUrl + "/Auftraege/28/2017-03-01", dataType: "json" } }, schema: { model: { id: "liTourIx" } }});(function () { app.auftraegeView.set('title', 'Aufträge'); app.auftraegeView.set('onShow', function () { dataSource.read(); app.auftraegeView.set('dataSource', dataSource); }) function checkConnection() { var networkState = navigator.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unbekannte Verbindung'; states[Connection.ETHERNET] = 'Ethernet Verbindung'; states[Connection.WIFI] = 'WiFi Verbindung'; states[Connection.CELL_2G] = 'Mobil 2G Verbindung'; states[Connection.CELL_3G] = 'Mobil 3G Verbindung'; states[Connection.CELL_4G] = 'Mobil 4G Verbindung'; states[Connection.CELL] = 'Mobil allgemein Verbindung'; states[Connection.NONE] = 'Keine Netzwerkverbindung'; return ('Netzwerk: ' + states[networkState]); } document.addEventListener("online", function () { console.log(checkConnection()); dataSource.online(true); dataSource.read(); }); document.addEventListener("offline", function () { console.log(checkConnection()); dataSource.online(false); });})();// END_CUSTOM_CODE_homeView
What am I doing wrong / don't understand?
Thanks, Tobi