0

让我首先说...我是一个菜鸟,并且已经倾注了文档,但我还没有找到解决方案。

我在 PowerSchool SIS 中使用 AngularJS 构建了一个自定义报告来形成我的网格,并使用 JSON 数据来填充它。我目前遇到的问题是网格只填充了 100 个项目,即使有接近 200 个记录项目。

这是我的 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

我们已经确认我的数据源没有问题。我被困住了,可以使用指导词。任何意见,将不胜感激。

4

1 回答 1

0

尝试使用 PostMan 访问同一端点,可能 API 无法正常工作。

另外我不确定这个网址是否有效:

网址:“/ws/schema/query/com.cortevo.reporting.attendance.absencebymonthschoolgrade”

于 2021-03-31T20:45:51.160 回答