JSDO Debugging - Forum - Mobile - Progress Community

JSDO Debugging

 Forum

JSDO Debugging

This question is answered

OE 11.5.1 Windows/Linux

We are currently trialling Pacific with Kendo UI & Angular. I have a page with a tab folder and a series of input fields. Leaving certain input field fires a generic JS function that fetches a description and populates a description field. All of this works just fine, apart from 1 field. Looking at the FF console, I can see the call to and it looks just fine (all the calls respond with this):

GET  http://10.200.12.90:18888/iSams/rest/iSams/contractTypeRevision [HTTP/1.1 200 OK 32ms]
GET http://10.200.12.90:18888/iSams/rest/_oeping  [HTTP/1.1 200 OK 4ms]

However, querying the JS object tells me the length of the data object is 1 and using data[iCount][fieldName] returns 'undefined', but calling the contractTypeRevision service in the browser returns all the records as expected.

Thoughts on how I can get to the bottom of this?

TIA

Verified Answer
  • In general, you do not need to call jsdo.fill() directly when using Kendo UI. The read() method of the data source internally calls fill() with an object that uses the JSON Filter Pattern.

    Yes, you can pass a filter to fill() passing the where clause as a string (available since first release):

    jsdo.fill("CustNum < 10")

    Thanks.

  • You are very welcome.

    A list of methods and events supported by the Progress JSDO can be found in the Mobile Applications book included with the OpenEdge documentation:

    community.progress.com/.../2352.openedge-11-5-product-documentation.aspx ( PDF and HTML )

    - documentation.progress.com/.../openedge115

    You can also download a PDF file with this information from GitHub at github.com/.../CDO

    Best regards.

All Replies
  • Hello,

    Just some quick feedback.

    Debugging this would depend on where this code is being used (stacktrace) and understanding what data should be set in that context?

    What is the actual value of data?

    Where are you trying to access data from?

    A template for a listview?

    Are you trying to use it from a template? (A while back there was a question related to Angular where the code needed a k-template.)

    I hope this helps.

  • Hi Edsel,

    Thanks!

    I've generated a R/O class using the new Business Entity in Dev Studio for this table. This has been deployed to our dev server and calling the service directly returns the data in the table (4 fields, 361 rows) The first line looks like:

    {"dsContractTypeRevision":{"ttContractTypeRevision":[{"ContractTypeCode":1,"ContractTypeRevision":1,"ContractTypeRevisionDesc":"New Contract","ActivationDate":"2001-11-30"},

    I have a data source defined:

    var keyType = new JSDOTransport(serviceURI, catalogURI, resourceName);

    var dataSource = new kendo.data.DataSource({

     transport: keyType.transport,

    });

    And then I pull the data with:

    dataSource.read().then(function() {<some code here>}

    There are no templates - just a basic form with a bunch of input fields. The confusing thing is the function is generic and only 1 field of 10 doesn't work.

  • You are welcome, Kevin.

    Is there anything special about the field that is not working (compared to other fields)? Perhaps, the datatype?

    I noticed that you are using JSDOTransport, this is an approach that we used the 3.1 version of the JSDO with Kendo UI.

    I wonder if the behavior that you are seeing would be different if you use the new version.

    It should be straight forward to use the new version of the JSDO and its support for the Kendo UI DataSource.

    The links listed below include examples. (I will try to add an example with Angular later.)

    Version 4.0 of the JSDO is now available and it now includes a JSDO dialect for the Kendo UI DataSource which has support for CRUD operations, Submit, serverPaging, serverFiltering, and serverSorting. You can also call invoke operations.

    The new version is available in the Telerik App Builder as the Progress Data Service template.

    Here are some links with information on the new version:

    - Information on Where to find the JSDO v 4.0:

       community.progress.com/.../18212.aspx

    - Update to the documentation with information on the new JSDOSession object, the JSDO and JSON Filter Pattern (JFP) which is needed to enable serverPaging, serverFiltering and serverSorting:

       documentation.progress.com/.../oemobile1151

    - Examples using the JSDP v4.0 with Kendo UI:

       community.progress.com/.../2020.aspx

    - Using the JSDO with Kendo UI:

       pugchallenge.org/downloads2014.html

       pugchallenge.org/.../398_Using_the_JSDO_with_Kendo_UI.zip

    Could you try using the new version to see if the problem still happens?

    You would need to create a new JSDOSession and create a DataSource with the following information:

       type: jsdo,

       transport: {

           jsdo: "Customer",

       },

       error: function(e) {

       }

    I hope this helps,

    Edsel

  • Hi Edsel,

    There are 2 functions: one that deals with strings and one that deals with numbers.This field is identical to any other number field.

    I've changed the code to use the 4.0 method but I now receive this error:

    TypeError: r is undefined  kendo.all.min.js:11:13234

    Code:

    var serviceURI = '10.200.12.90/iSams&,

       jsdoSettings = {

       serviceURI: serviceURI,

       catalogURIs: serviceURI + "/static/mobile/iSamsService.json"

        },

        jsdosession,

        jsdo,                

        resourceName = resource;

    jsdosession = new progress.data.JSDOSession(jsdoSettings);

    var dataSource = new kendo.data.DataSource({

       type: jsdo,

       transport: {

         jsdo: resourceName,

        },

        error: function(e) {

        }

      });                            

    dataSource.read().then(function() {...

    Cheers,

    Kevin

  • Hello Kevin,

    Thank you for changing to use the new approach.

    Could you use the progress.all.js file for debugging?

    Are you using anonymous access or do you need to authenticate with the server?

    If you need to authenticate, then you need to specify authenticationModel in the settings for the JSDO Session.

    Please notice that you also need to call addCatalog() before calling the creation of the DataSource.

    Thanks,

    Edsel

  • Hi Edsel,

    I got around that error by switching the code to be similar to what you have in your presentation (using jsdo.fill()), which leads me to a new question:

    How do I implement serverFiltering using this method? Can I pass a filter into the fill() method?

    Thanks,

    Kevin

  • In general, you do not need to call jsdo.fill() directly when using Kendo UI. The read() method of the data source internally calls fill() with an object that uses the JSON Filter Pattern.

    Yes, you can pass a filter to fill() passing the where clause as a string (available since first release):

    jsdo.fill("CustNum < 10")

    Thanks.

  • Thanks very much for all that. If I use the datasource.read() it errors with the TypeError I mentioned above but the fill method works just fine with the filter.

    One last question: Is there a document that lists all the methods and events supported by the Progress JSDO?

  • You are very welcome.

    A list of methods and events supported by the Progress JSDO can be found in the Mobile Applications book included with the OpenEdge documentation:

    community.progress.com/.../2352.openedge-11-5-product-documentation.aspx ( PDF and HTML )

    - documentation.progress.com/.../openedge115

    You can also download a PDF file with this information from GitHub at github.com/.../CDO

    Best regards.

  • Brilliant, thanks.