什么是用于kendo-spreadsheet的Angular Kendo UI指令?

时间:2016-03-09 07:00:12

标签: angularjs kendo-ui angular-kendo

我尝试使用angular指令实现Kendo spreadsheet widget,但它没有显示出来。

这是我的代码:

HTML:

<div kendo-spreadsheet style="height:580px;" k-options="spreadsheetOptions"></div>

控制器:

$scope.spreadsheetOptions = {
            sheets: [{
                name: "Food Order",
                mergedCells: [
                    "A1:G1"
                ],
                rows: [{
                    height: 70,
                    cells: [{
                        value: "My Company", fontSize: 32, textAlign: "center"
                    }]
                }],
            }],
            excel: {
                fileName: "Order.xlsx"
            }
        };

控制台中也没有显示错误。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

Kendo Angular Spreadsheet指令正常工作。请看下面的例子。您也可以在html文件中粘贴以下示例。

    <!DOCTYPE html>
<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/grid/angular">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.226/styles/kendo.common-bootstrap.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.226/styles/kendo.bootstrap.min.css" />

    <script src="//kendo.cdn.telerik.com/2016.1.226/js/jquery.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.1.226/js/angular.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.1.226/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example" ng-app="KendoDemos">
    <div ng-controller="MyCtrl">
        <div  kendo-spreadsheet style="width:100%" k-options="spreadsheetOptions"></div>
    </div>
</div>

<script>
    angular.module("KendoDemos", [ "kendo.directives" ])
        .controller("MyCtrl", function($scope){
           $scope.spreadsheetOptions = {
            sheets: [{
                name: "Food Order",
                mergedCells: [
                    "A1:G1"
                ],
                rows: [{
                    height: 70,
                    cells: [{
                        value: "My Company", fontSize: 32, textAlign: "center"
                    }]
                }],
            }],
            excel: {
                fileName: "Order.xlsx"
            }
        };
        })
</script>


</body>
</html>