This is a migrated thread and some comments may be shown as answers.

Grid Rendering Error

3 Answers 228 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arie
Top achievements
Rank 1
Arie asked on 14 Oct 2015, 08:37 PM

I am receiving an error of  

"Cannot read property 'find' of undefined"

  when trying to render a grid control on a view component of an MVC 6 application that I am currently working on.

 

The error is coming from this portion of code in the kendo.all.js file where it appears to be trying to find the loading mask but says that container is undefined

progress: function(container, toggle) {
            var mask = container.find(".k-loading-mask"),
                support = kendo.support,
                browser = support.browser,
                isRtl, leftRight, webkitCorrection, containerScrollLeft;

 

The grid I am trying to populate seems pretty straight-forward to me .....below is the typescript I am using... what am I a doing wrong

 

    $("#ConditionsSearchGrid").kendoGrid({
        dataSource: {
            transport: {
                read: this._main.action_searchcondition.ResolveAction(),
                contentType: "application/json; charset=utf-8"
            },
            parameterMap: function (data, operation) {
 
                return {
                    searchstring: $("#searchstringtextbox").val()
                }
 
            },
            error: function (e) {
                var msg = e.xhr.responseText;
                alert(msg);
            },
            schema: {
                model: {
                    fields: {
                        DiscName: { type: "number" },
                        Diagnosis_Description: { type: "number" },
                        Short_Description: { type: "string" },
                        IsSelected: { type: "bool" },
                        ICD9_cd: { type: "string" },
                        onset: { type: "string" },
                        isduplicate: { type: "bool" }
                    }
                }
            }
        },
        dataBound: this.ConditionsSearchLineItems_Databound,
        height: 430,
        sortable: true,
        scrollable: {
            virtual: true
        },
        selectable: "multiple row",
        columns: [
            {
            template: "<input type='checkbox' #= IsSelected?
                 checked='checked':checked='' # class='chkbx' />",
            field: "IsSelected",
            title: " "
        },
            {
                field: "DiscName",
                title: "Caredisc",
                width: "40%"
            }, {
                field: "ICD9_cd",
                title: "Code",
                width: "10%"
            }, {
                field: "Diagnosis_Description",
                title: "Diagnosis",
                width: "40%"
            }, {
                field: "onset",
                title: "Type"
            }]
    });
 
}

 

       

 

 

 

 

 

 

 
 
 

3 Answers, 1 is accepted

Sort by
0
Arie
Top achievements
Rank 1
answered on 15 Oct 2015, 04:05 AM

Additionally, we did update the model field definitions to straighten out the type but that doesn't seem to help.
The grid does go out and hit the controller and the controller has a default set of data that is passed back if the searchstring parameter is null or empty string.

I also see in the kendo ui component for chrome that the data object holds an array of 65 objects ..... looks like

data: Array[1]

     0: Object{4}

             Data: Array[65]

 

So the symptoms that we are still seeing is

 1. error regarding the javascript in the portion mentioned in the above post

 2. grid display 1 blank row

 3. parameters are not passed to the controller action

 4. data source contains 65 objects but they are not displayed.

0
Arie
Top achievements
Rank 1
answered on 15 Oct 2015, 11:41 AM

Ok, we figured it out early this morning that the blank grid was just caused by the need to have the data: "Data" added to the schema property so that  it to properly consume the data coming back from the ActionResult.

So now data is displaying properly but we still have the nagging error of the Uncaught TypeError as described above and it will not send the parameter to the controller ... so we are still dealing with that...

0
Rosen
Telerik team
answered on 16 Oct 2015, 01:09 PM

Hello Arie,

 

The parameter is not send as the parameterMap declaration is misplaced. The parameterMap is part of transport declaration. As the contentType is part of the transport.read configuration.

Regarding the error you have mentioned. It is not obvious, from the provided information, what is the cause for such error. However, you should verify that you are not manually calling kendo.progress, for example inside the dataBound event handler of the grid, using incorrect container. If you continue to experience difficulties please provide a small test page which demonstrates this issue. 

 

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Arie
Top achievements
Rank 1
Answers by
Arie
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or