Question

My Jaydata and OData endpoint are completely functional. :)

When I have a database with less than 50 entries, everything works perfect. But for ALL of my databases with 50+ entries, JayData's .forEach only iterates through the first 50.

At first I though it was a database issue, but I've tried it on three different tables.

I also put a print statement in .forEach to validate it was only called 50 times: enter image description here

My javascript is (note I removed the http:// before localhost because stackoverflow won't let me post a localhost url):

var ctx = new WebApplication.resource_dbEntities({ name: 'oData', oDataServiceHost: 'localhost:8080/Resource/example.svc' });

    ctx.onReady(function() {
        
            ctx.department
            //.filter( function ( per ) { return per.person_active == 1 } )
            .toArray().then(function(dep){
               dep.forEach(function(d) {
                console.log("This will print 50 times");
                    var item = "<li class=@cls data-id=@id><a href=#>@name</a></li>"
                            .replace("@cls", 'category')
                            .replace("@id", d.department_id)
                            .replace("@name",d.department_name);
                             $('#departments').append(item);
               });
          })
        
          .fail(function(r){
            console.log(r);
          });
        
        });

Has anyone encountered a similar issue? Thanks all!

Was it helpful?

Solution

Might be a server issue. From your browser open the url .../Resource/example.svc/department and see what you get, you might have to look at the page source or the network traffic

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top