Why is my datasource not returning all my data in Angular grid application>?

124 Views Asked by At

Let me first preface this by saying...I'm a noob and have been pouring over documentation already but I have not found a resolution.

I have built a custom report in PowerSchool SIS using AngularJS to form my grid and am using JSON data to fill it. The problem I am currently having is the grid is only populating 100 items even though there are close to 200 record items.

This is my JS:

//Begin Module - Loads AngularJS
define(['angular', 'components/shared/index'], function(angular) {
    var attApp = angular.module('attApp', ['powerSchoolModule']);
    // var yearid = window.location.search.split("=")[1];
    
  
    //Begin Controller 
    attApp.controller('attCtrl', ['$scope', 'getData', '$attrs', function($scope, getData, $attrs) {
  
        $scope.curSchoolId = $attrs.ngCurSchoolId;
        $scope.curYearId = $attrs.ngCurYearId;
  
        loadingDialog();
        $scope.attList = [];
        //Sets definition of the var dataSource to pull PowerQueries
        var dataSource = {
            method: "POST",
            url: "/ws/schema/query/com.cortevo.reporting.attendance.absencebymonthschoolgrade",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            data: {yearid},
            dataType: "json",
            pages:"50",
        };
        console.log(dataSource);
        //Sets definition of the var dataSource to pull from JSON files
        console.log('loading dataSource');
        //var dataSource= {method: "GET", url: "attendancedata.json"}; 
        getData.getAttData(dataSource).then(function(retData) {
  
            if (!retData.record) {
                alert('There was no data returned');
                closeLoading();
            } else {
                console.log(retData);
  
                 if (!!retData.record[retData.record.length]) {
                //    retData.record.pop();
                }
                var i = retData.record.length;
                while (i--) {
                    retData.record[i].attendance_date = new Date(retData.record[i].attendance_date) // Changes the text of the attendance date to a JS data
                }
                //Sets scope of attList and attName
                $scope.attList = retData.record; 
                $scope.attName = retData.name;
                console.log($scope.attList);
                closeLoading();
            }
        });
  
    }]); //End Controller
  
    //Begins factory and invokes PowerQueries if available, error message will trigger if no data returned
    attApp.factory('getData', function($http) {
        return {
            getAttData: function(dataSource) {
                return $http(dataSource).then(function successCallback(response) {
                        return response.data;
                    },
                    function errorCallback(response) {
                        alert('There was an error returning data');
                    });
            }
        }
    }); //End Factory
  
  
  }); //End Module

We have confirmed there is nothing wrong with my datasource. I'm stuck and could use a guiding word. Any advice would be appreciated.

1

There are 1 best solutions below

1
David Castro On

Try to hit the same endpoint using PostMan, maybe the API is not working.

Also I'm not sure if this url is valid:

url: "/ws/schema/query/com.cortevo.reporting.attendance.absencebymonthschoolgrade"