javascript - TypeError : r. getClientRects 不是函数

标签 javascript html kendo-ui toolbar kendo-ui-grid

我正在尝试通过以下链接在 KendoUI 网格中创建自定义工具栏:http://demos.telerik.com/kendo-ui/grid/toolbar-template但遇到错误。

这就是我想在我的代码中做的事情:

<div id="example">
    <script type="text/x-kendo-template" id="template">
        <div class="toolbar">
            <label class="category-label" for="category">Show products by category:</label>
            <input type="search" id="category" style="width: 150px" />
        </div>
    </script>
    <div id="grid"></div>
    <script>
        $(document).ready(function () {
            var grid = $("#grid").kendoGrid({
                dataSource: {

                    transport: {
                        read: {
                            url: 'http://localhost:52738/Default1/KendoDataAjaxHandle',
                            type: "post",
                            dataType: "json"
                        }
                    },
                    schema: {
                        data: "Data",
                        total: function (response) {
                            return $(response.Data).length;
                        }
                    },
                    pageSize: 10
                },
                toolbar: kendo.template($("#template").html()),
                groupable: true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 5
                },
                columns: [
                            {
                                field: "CustomerAltID",
                                filterable: true
                            },
                            {
                                field: "CustomerID",
                                title: "Customer ID"
                            },

                            {
                                field: "CustomerName",
                                title: "Customer Name",

                                template: "<div class='customer-photo'" +
                                                            "style='background-image: url(../Content/Images/customerimg/#:data.CustomerID#.jpg);'></div>" +
                                                        "<div class='customer-name'>#: CustomerName #</div>"
                            },
                            {
                                field: "Gender",
                                title: "Gender",
                                template: "<div class='gender-photo'" +
                                                            "style='background-image: url(../Content/Images/#:data.Gender#.jpg);'></div>" 

                            }
                ]
            });
            var dropDown = grid.find("#category").kendoDropDownList({
                dataTextField: "Gender",
                dataValueField: "CustomerID",
                autoBind: false,
                optionLabel: "All",
                dataSource: {

                    severFiltering: true,
                    transport: {
                        read: {
                            url: 'http://localhost:52738/Default1/KendoDataAjaxHandle',
                            type: "post",
                            dataType: "json"
                        }
                    },
                    schema: {
                        data:"Data"
                    }
                },
                change: function () {
                    var value = this.value();
                    if (value) {
                        grid.data("kendoGrid").dataSource.filter({ field: "CustomerID", operator: "eq", value: parseInt(value) });
                    } else {
                        grid.data("kendoGrid").dataSource.filter({});
                    }
                }
            });
        });
    </script>
</div>

我不知道问题出在哪里,而且我已经好几个小时都找不到解决方案了。

我正在使用以下版本 - Jquery v-3.1 和 Jquery UI-1.12

最佳答案

github issue 中提到的另一种可能性是包括<script src="https://code.jquery.com/jquery-migrate-3.0.0.min.js"></script>在 html 中。这对我有用。

关于javascript - TypeError : r. getClientRects 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41362670/

相关文章:

javascript - Cypress - 如何从 .t​​hen() 返回新值?

javascript - 对讲机 ECMASCRIPT6 标签管理器错误

javascript - 如何在使用 highcharts-ng 和 angularjs 执行 setInterval 函数时更改 div 中的文本

javascript - 通过 Yammer API 上传文件

javascript - 剑道上传中按id删除文件

asp.net-mvc - Kendoui MVC EditorTemplateName 在 PopUp 编辑模式下不起作用

html - 如何根据百分比获得2种背景颜色,我选择

html - 为什么表格的存在会破坏垂直对齐?

html - 在具有基于 px 边距的容器内使用基于 % 的宽度 div

kendo-ui - 剑道数据源传输自定义函数未被调用