0

i am new with JayData, i have an OData service which i want to consume with JayData i have this function

$data.initService('/odata')
            .then(function (context) {
                // manage your data through context with JSLQ

                context.Store.forEach(function (s) {
                    alert(s.Name);
                    })

            });

but the i never get to the foreach my model is

public class Product
{
    public int ID { get; set; }
    public string Name { get; set; }
}

public class Store
{
    public int ID { get; set; }
    public string Name { get; set; }

    public List<Product> Products { get; set; }
}

i have changed to use JaySvcUtil - and generated entity model, how ever i got strange request, when it goes to the server i get error 500 cause it use text/plain

 var oProviderConfig = {
                name: 'oData',
                oDataServiceHost: 'http://localhost:16894/odata'
            };

            var c = new $data.generatedContexts[0](oProviderConfig);
            c.onReady(function () {
                c._Store.forEach(function (s) {
                    alert(s.Name);
                });
            });

GET 500 Internal Server Error text/plain datajs-1.1.0.js:2484 Script 358 B 0 B

li-raz
  • 1,678
  • 2
  • 29
  • 57
  • raz, Please check the error console of your browser! The following errors can cause the issue: -missing data.js -missing jquery -incorrect order of the included libraries. I datajs must be placed before jaydata, like: jquery, datajs, jaydata -incorrect service url -server-side error Let me know if you have a detailed error message. – Robesz Jul 25 '13 at 06:55

1 Answers1

1
 var oProviderConfig = {
                name: 'oData',
                oDataServiceHost: 'http://localhost:16894/odata',
                maxDataServiceVersion: '3.0'
            };

that fixed it

li-raz
  • 1,678
  • 2
  • 29
  • 57