Skip to Content
0
Former Member
Dec 18, 2013 at 10:16 AM

Offline update operation.

24 Views

I am creating hybrid App with offline mode in SUP 2.2 and faced problem with update operation. In project for now is only 1 MBO - tasks. I have created an update operation and it works well while online. On TasksDetail screen I have added 2 custom actions :

1. offlineUpdate - (type - Submit hybrid App)

2. onlineUpdate - (type - online request)

Also I have created menu item Update with type - custom and extend custom.js

hwc.customBeforeMenuItemClick = function(screen, menuItem) {

if (screen === "TasksDetail" && menuItem === "Update") {

var isDeviceOnline = false;

isDeviceOnline = window.navigator.onLine;

var clientInitiated = false;

if (isDeviceOnline) {

menuItemCallbackTasksDetailonlineUpdate();

}

else {

if (!clientInitiated) {

doSaveAction(false);

menuItemCallbackTasksDetailofflineUpdate();

}

else {

doSaveAction(false);

doSaveAction(false);

menuItemCallbackTasksDetailofflineUpdate();

}

}

}

return true;

};

In this case clientInitiated is always 'false' , but with 'true' it also does not work the way I want.

So In online mode this code works perfect. In offline mode , when I press Update the App is closed and I see the list of Hybrid apps. I don't want that behaviour. how I can avoid that .

Thank in advance.

Attachments

OfflineMode.PNG (29.1 kB)