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

Error Object doesn't support property or method '_observe' using the kendo grid

1 Answer 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keymer
Top achievements
Rank 1
Keymer asked on 07 Oct 2012, 08:01 PM
Hello, I'm having the following problem to implement the kendo  grid:

This is my code in client side:

   $(document).ready(function () { 
      var dataSource = kendo.data.DataSource({             
        transport: {                 
            read: {                     
                url: '@Url.Action("GetAll""Company")',                     
                dataType:"json"                
            },             
            schema: {                 
                data: "Companies",                 
                total: "TotalCount",                
                model: {                                      
                    id: 'CompanyID',                     
                    fields: {                         
                        CompanyID:{                             
                            type: 'number',                             
                            nullable: true,                             
                            editable:false                         
                        },                         
                        Name:{                                              
                            type: 'string'                         
                        },                         
                        Rif:{                                              
                            type: 'string'                           
                        },                         
                        Telephone:{                             
                            type: 'string'                         
                        },                         
                        FisicalAddress:{                                             
                            type: 'string'                         
                      }                     
                    }               
                }             
            },             
            pageSize: 1         
        });         

        $("#grid").kendoGrid({             
            dataSource: dataSource,             
            height: 250,             
            scrollable: true,             
            sortable: true,             
            filterable: true,             
            pageable: {                 
            input: false,                 
            numeric: true             
          },             
            columns: [ { field: "CompanyID",  title: "#",  width: 150 },
                       { field: "Name", title: "Name", width: 150   },                            
                       { field: "Rif", width: 150 },
 { field: "Telephone", title: "Telephone"},
                       {  field: "FisicalAddress", width: 300 }]
    });
});

and this is my code in server side:

public JsonResult GetAll(
{            
    var companies = _companyService.GetAll().Select(c => new { c.CompanyID, c.Name, c.Rif, c.Telephone, c.FiscalAddress});
     return Json(new { Companies = companies, TotalCount = companies.Count()},JsonRequestBehavior.AllowGet);
}

Error description in file kendo.web.min.js or kendo.data.min.js
Microsoft JScript runtime error: Object doesn't support property or method '_observe'

Any idea what may be happening? Thank you for help

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 10 Oct 2012, 11:25 AM
Hi Keymer,

Looking at the code snippets you have pasted, it seems that the schema declaration is not defined correctly. The schema is setting of the DataSource, not of the transport as in your snippet.

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