Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oj.Collection how to sync with mcs backend service call

PriyaTBDec 31 2018 — edited Jan 2 2019

Hi,

I am using latest jet and cardova. I wan to call a custom api from mcs backend and sync it with a collection. I am able to call my mcs service. But I am not able to sync it with collection. I am trying to use the "sync" of oj.Collection

       function reqCollectionSync( ) {

            mcsBackend.MobileBackend.CustomCode.invokeCustomCodeJSONRequest("REQ/requisitions?number=ALL","GET",{},

            function (status,data,header) {

               console.log('call success');

               console.log(data);

            },

            function (statusCode, data) {

                console.log('failure');

            });     

        };

     self.reqCollection =  new oj.Collection(null,{

            // url not required when using sync

            model: self.reqModel,

            comparator: "Id",

            sync : reqCollectionSync()

        });

self.reqData = ko.observable(new oj.CollectionTableDataSource(self.reqCollection ));

This is how I am calling the service. I am able to see the logs of my success callback and i am able see the valid response data in the console log. Now how to map the response data on the collection ?. Is there any better way to achieve the same ? Please help me with this. I am stuck at this point.

Comments
Post Details
Added on Dec 31 2018
1 comment
217 views