Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnCaught TypeError $(...).kendoGrid is not a function

Earlier on and many days before today, I have never gotten this error, I am getting data returned, but it won't show the data because of this error

UnCaught TypeError $(...).kendoGrid is not a function

My grid is this..

    function ShowAdministratorsGrid(administratorData) {
    $("#adminGrid").kendoGrid({
        dataSource: {
            data: administratorData
        },
        columns: [{
            field: "administratorID",
            title: "AdministratorID",
            hidden: true
        },
        {
            field: "administratorName",
            title: "AdministratorName"
        },
        {
            field: "dateCreated",
            title: "DateCreated"
        },
        {
            field: "createdBy",
            title: "CreatedBy"
        }],
        scrollable: true,
        sortable: true,
        pageable: false,
        selectable: "row",
        change: function (e) {
            onRowSelectForAdministrator();
        },
        height: 275
    });
}

and I am populating it like this..

    function ShowAdministratorsInformation() {
    $.ajax({
        type: "GET",
        url: AddURLParam.AddGetAdminInformationURL,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function (data, textStatus, jqXHR) {
            ShowAdministratorsGrid(data);
        }
    })
}

But as I have mentioned it was working until earlier and I have no idea why this error is being thrown. I have looked around for this error pertaining to the kendoGrid to no avail.

So up until an hour or two ago everything worked.

like image 397
Chris Avatar asked Oct 02 '15 23:10

Chris


2 Answers

Documented Solution: this problem is already documented. it says:

Widgets Are Unavailable or Undefined:

If jQuery is included more than once in the page all existing jQuery plugins (including Kendo UI) will be wiped out. Will also occur if the required Kendo JavaScript files are not included.

Depending on the browser, the following JavaScript errors will be thrown:

TypeError: Object #<Object> has no method kendoGrid (in Google Chrome)
TypeError: $("#Grid").kendoGrid is not a function (in Firefox)
Object does not support property or method 'kendoGrid' (in Internet Explorer 9 and later)
Object does not support this property or method (in older versions of Internet Explorer)

Solution:

Make sure jQuery is not included more than once in your page. Remove any duplicate script references to jQuery. Include all required Kendo JavaScript files.

jQuery Is Unavailable or Undefined:

If jQuery is not included, or is included after the Kendo UI JavaScript files, or is included after Kendo UI widget initialization statements, the Kendo UI widgets will not function as expected. The following JavaScript errors will be thrown (depending on the browser):

ReferenceError: jQuery is not defined (in Google Chrome and Firefox)
'jQuery' is undefined (in Internet Explorer)

Solution:

Make sure that jQuery is included only before the Kendo UI JavaScript files and before any Javascript statements that depend on it.

Source -Answer

like image 145
Kaleem Ullah Avatar answered Nov 15 '22 01:11

Kaleem Ullah


make sure your script below inside tag <head>...</head>

<script src="kendo/js/jquery.min.js"> </script>

example

   <head>
      <title>......</title>
      <script src="kendo/js/jquery.min.js"> </script>
      // and then your other script
   </head>

Hope it is useful

like image 27
Ardi Avatar answered Nov 15 '22 02:11

Ardi