Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 剑道寻呼机(可寻呼)显示“没有要显示的项目”,即使记录存在_Javascript_Angularjs_Kendo Ui_Pagination_Kendo Grid - Fatal编程技术网

Javascript 剑道寻呼机(可寻呼)显示“没有要显示的项目”,即使记录存在

Javascript 剑道寻呼机(可寻呼)显示“没有要显示的项目”,即使记录存在,javascript,angularjs,kendo-ui,pagination,kendo-grid,Javascript,Angularjs,Kendo Ui,Pagination,Kendo Grid,这里我使用剑道UI和角度JS 在集成剑道网格表上的分页时遇到问题,即使数据记录加载正确,也会显示“没有要显示的项” 不确定有什么问题,任何帮助都会被占用 下面是我用来加载/初始化数据网格的函数 function getProjectsAtAGlance() { $scope.gridOptions = { scrollable: false, sortable: true,

这里我使用剑道UI和角度JS

在集成剑道网格表上的分页时遇到问题,即使数据记录加载正确,也会显示“没有要显示的项”

不确定有什么问题,任何帮助都会被占用

下面是我用来加载/初始化数据网格的函数

function getProjectsAtAGlance() {
                $scope.gridOptions = {
                    scrollable: false,
                    sortable: true,
                    pageable: {
                        pageSizes: [5, 10, 15, 20, 25, 50]
                    },
                    change: function (e) {
                        $scope.pageSize = $scope.gridOptions.dataSource.pageSize();
                    },
                    dataSource: {
                        serverPaging: true,
                        transport: {
                            read: function (options) {

                                $scope.options = options;

                                var filters = {
                                    skip: options.data.skip,
                                    take: options.data.take,
                                    sortBy: $scope.sortBy,
                                    projectGlanceIncludeArchived: $scope.includeArchivedProjects,
                                    projectGlanceExcludeProjectsWithNoBudgets: $scope.excludeProjectsWithNoBudgets
                                };

                                $http.post("/Home/ProjectsAtAGlanceReport", filters)
                                    .success(function (result) {
                                        var projects = result.projects;

                                        for (var i = 0; i < projects.length; i++) {
                                            var project = projects[i];
                                            project.startDate = moment(projects[i].startDate).format("L");
                                            project.endDate = moment(projects[i].endDate).format("L");
                                        }

                                        options.success(projects);

                                    })
                                    .error(function (error) {
                                        console.log(error);
                                    });
                            }
                        },
                        pageSize: $scope.pageSize,

                        schema: {
                            total: function (respose) {
                                return $scope.data;
                            },

                            model: {
                                fields: {
                                    name: {
                                        editable: false,
                                        nullable: true
                                    },
                                    resourceCount: {
                                        editable: false,
                                        nullable: true
                                    },
                                    clientName: {
                                        editable: false,
                                        nullable: true
                                    },
                                    startDate: {
                                        editable: false,
                                        nullable: true
                                    },
                                    endDate: {
                                        editable: false,
                                        nullable: true
                                    },
                                    projectId: {
                                        editable: false,
                                        nullable: true
                                    },
                                    projectedBudgetPercentage: {
                                        defaultValue: 100
                                    },
                                    defaultValue: {
                                        totalBudget: 0,
                                        totalHours: 0,
                                        burnedBudget: 0,
                                        burnedHours: 0,
                                        projectedBudget: 0,                                         
                                        projectedHours: 0,
                                        projectedHoursPercentage: 0,
                                        remainingBudget: 0,
                                        remainingBudgetPercentage: 0,
                                        remainingHours: 0,
                                        remainingHoursPercentage: 0
                                    }
                                }
                            }
                        }
                    },

                    columns: [
                        {
                            template: "<div class='name-column'>" +
                                "<p><a class='highlighted-blue' href='/Projects/ProjectAdmin/{{dataItem.projectId}}'>{{dataItem.name}}</a></p>" +
                                "<small>{{dataItem.clientName}}</small>" +
                                "<small ng-if=\"dataItem.startDate !== 'Invalid date'\">{{dataItem.startDate}} - {{dataItem.endDate}}</small>" +
                                "<small ng-if=\"dataItem.startDate === 'Invalid date'\"><i class='fa fa-exclamation-triangle text-danger'></i> Start date and end date are not defined.</small>" +
                                "<small>{{dataItem.resourceCount}} Resources</small></div>"

                        },
                        {
                            template: kendo.template($("#kendoProgressBarColumnTemplate").html())
                        },
                        {
                            template: "<accuracy-gauge-per-project accuracy='dataItem.accuracy'></accuracy-gauge-per-project>"
                        },
                        {
                            template:
                                "<p>{{dataItem.accuracy | percentage:0}} Accurate</p>" +
                                "<p>{{100-dataItem.accuracy | percentage:0}} Non Accurate</p>"
                        }
                    ]
                };
            }
下面是一个输出代码片段供参考。

我认为属性需要在数据源中声明,如下所示:


并根据将schema.total返回的内容更改为return response.total。

另一件事,response包含什么内容?这个函数是否应该不返回respose.total?是的,Sandman,你是对的,“schema.total”有问题。我已经删除了total:function respose{return$scope.data;},以进行检查,它现在工作正常。很高兴听到您已经让它工作了。请不要忘记投票,如果答案能带来解决方案,请接受它
dataSource: {
    serverPaging: true,
    transport: {... // transport options
    },
    pageSize: $scope.pageSize // before end of dataSource       
},... // more grid stuff