【问题标题】:Kendo js takes too much time while downloading on client sideKendo js在客户端下载时花费了太多时间
【发布时间】:2017-02-12 05:33:56
【问题描述】:

我在我的项目中使用 kendo ui 调度程序,但是在客户端下载 kendo js 和 css 需要太多时间,因此我们的网站会出现一些缓慢。为了克服这个问题,我们试图根据请求仅在加载调度程序日历的页面上下载 kendo js 和 css。虽然集成相同,但我们无法添加依赖项“kendo.directive”。请建议如何添加该依赖项或替代方法来减少这么多的延迟。

请找到相同的代码。

myApp.requires.push('kendo.directives');

myApp.controller('CalenderController',['$scope', '$http', 'StatsService', function ($scope, $http, StatsService) {
    var self=this;

    $scope.schedulerOptions = {
        date: new Date(),
        startTime: new Date(),
        showWorkHours: true,
        height: 600,
        views: [
            "day",
            {type: "week", selected: true},

        ],
        editable: {
            destroy: false,
            create: false,
            template: $("#editor").html()
        },
        timezone: "GMT",
        dataSource: {
            batch: true,
            transport: {
                read: function (options) {
                    url = '/consultants/applications/interviews';
                    $http.get(url).success(function (data, status, headers, config) {
                        options.success(data.result);
                    }).error(function (data, status, headers, config) {
                        options.error(data);
                    });
                },
                parameterMap: function (options, operation) {
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }
            },
            schema: {
                model: {
                    id: "interviewId",
                    fields: {
                        taskId: {from: "id", type: "number", editable: false},
                        candidateName: {from: "candidateName" , editable: false},
                        title: {from: "title", defaultValue: "No title" , editable: false},
                        companyName: {from: "companyName" , editable: false},
                        start: {type: "date", from: "interviewTiming", editable: false},
                        end: {type: "date", from: "interviewEndTiming" , editable: false},
                        candidateEmail: {from: "candidateEmail" , editable: false},
                        candidateMobile: {from: "candidateMobile" , editable: false}
                    }
                }
            }
        }
    };
}]);

【问题讨论】:

    标签: css angularjs user-interface kendo-ui scheduler


    【解决方案1】:

    使用自定义组合脚本,小于kendo.all.min.js...

    http://docs.telerik.com/kendo-ui/intro/installation/what-you-need#build-scripts

    ...或使用单独的脚本文件:

    http://docs.telerik.com/kendo-ui/intro/installation/what-you-need#individual-widget-scripts

    在这两种情况下,加载的脚本文件的大小都会减小。

    很遗憾,CSS 代码不存在相同的选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-06
      • 2017-02-15
      • 2020-07-23
      • 2013-07-11
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多