Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError : r.getClientRects is not a function

I am trying to create a custom toolbar in KendoUI grid following this link:http://demos.telerik.com/kendo-ui/grid/toolbar-template but getting stuck with an error.

This is what I am trying to do in my code:

<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>

I don't know what the problem is and its been hours that I am unable to figure out the solution for it.

I am using the following versions- Jquery v-3.1 and Jquery UI-1.12

like image 799
Aakash Thakur Avatar asked Dec 28 '16 13:12

Aakash Thakur


1 Answers

Another possibility as mentioned in this github issue is to include <script src="https://code.jquery.com/jquery-migrate-3.0.0.min.js"></script> in html. This worked for me.

like image 110
Dreams Avatar answered Oct 16 '22 08:10

Dreams