【问题标题】:kendo ui angular js grid ng-repeat剑道 ui 角度 js 网格 ng-repeat
【发布时间】:2013-07-30 19:09:59
【问题描述】:

我正在尝试在我的 Angular js 应用程序中使用 Kendo 网格。我正在创建一个指令,以便可以在应用程序的不同表中使用它。一旦 ng-repeat 呈现我想要调用的 dom: 元素.kendogrid()。 由于 ng-repeat 没有渲染后回调,因此有人建议使用两个指令: 1-

angular.module('app')

.directive('rowDirective', function () {
    return function(scope, element){
        if (scope.$last){
            scope.$emit('LastElementMessage');
        }
    };
});

2-

angular.module('app')

.directive('tableDirective', function () {
    return function(scope, element){
        scope.$on('LastElementMessage', function(event){
            $(element).kendoGrid({
                scrollable: true,
                sortable: true,
            });
        });
    }
});

这种方法效果很好,并且一切都按应有的顺序执行。 ng-repeat 可以自己正常工作,这意味着它以正确的顺序呈现项目,但是当我使用 kendo-grid 时,它会在网格内呈现:{{customer.CustomerID}}。有没有人经历过这样的事情?

【问题讨论】:

    标签: angularjs grid kendo-ui ng-repeat


    【解决方案1】:

    好吧,也许你应该看看 http://kendo-labs.github.io/angular-kendo/ 的 Angular Kendo UI 项目 - 它在将 Kendo UI 与 AngularJS“结合”方面做得相当不错。

    【讨论】:

      【解决方案2】:

      http://demos.telerik.com/kendo-ui/grid/angular

      有一些特定的自定义指令可以让 kendo ui 与 angular js 很好地配合使用。例如。 k-data-source、k-columns、k-selectable、k-pageable。这些应该包含在最新版本的 kendo ui 中。只需确保将“kendo.directives”作为对顶级模块的依赖项:

      var MyModule = angular.module('MyModule', ["ngRoute", "kendo.directives"]);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-07-05
        • 1970-01-01
        • 1970-01-01
        • 2018-11-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多