li-raz
li-raz

Reputation: 1696

Using JayData with dynamic init

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

Upvotes: 0

Views: 426

Answers (1)

li-raz
li-raz

Reputation: 1696

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

that fixed it

Upvotes: 1

Related Questions