Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

jquery - Javascript runtime error: "object doesn't support property or method" in Internet Explorer

I'm using kendo grids and they work fine for the CRUD operations. Now, I wanted to add filtering by adding the .Filterable() option to the grid's specification. Here's some code:

<div id="datagrid">
    @(Html.Kendo().Grid<SustIMS.Models.ConcessionModel>()
    .Name("datagrid_Concessions")
    .Columns(columns =>
    {
        columns.Bound(c => c.Code).Title("Code");
        columns.Bound(c => c.Description).Title("Description");
        columns.Bound(c => c.TrafficOpeningDate).Title("Traffic Opening Date");
        columns.Bound(c => c.CreationDate).Title("Creation Date");
    })
    .HtmlAttributes(new { style = "height: 534px;" })
    .Filterable() // here's the filterable option
    .Selectable()
    .Events(e => e.Change("onChange"))
    .Pageable(pageable => pageable
        .Refresh(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(15)
        .Read(read => read.Action("GetConcessions", "MasterData"))
    )
    )
</div>

The grid renders perfectly and now little filter icons show on the grid's column headers:

img

But when I click one, the popup opens for a half second and the error is thrown. I'm using Visual Studio 2010 and the debugger shows a popup with javascript runtime error: object doesn't support property or method 'addBack'.

Also, it opens the file kendo.all.min.js with an highlight on a line of code where a method addBack is.

NOTE: I've tested on Chrome and Firefox and it works fine. The issue only exists when using Internet Explorer (version 11).

Any help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Make sure you have Jquery-1.8.1.min.js or higher version of jquery in your page.Because addBack is added in 1.8.

Try like this,

 @(Html.Kendo().Grid<SustIMS.Models.ConcessionModel>()

    .Name("datagrid_Concessions")
    .Columns(columns =>
    {
        columns.Bound(c => c.Code).Title("Code");
        columns.Bound(c => c.Description).Title("Description");
        columns.Bound(c => c.TrafficOpeningDate).Title("Traffic Opening Date");
        columns.Bound(c => c.CreationDate).Title("Creation Date");
    })
    .HtmlAttributes(new { style = "height: 534px;" })
    .Filterable() // here's the filterable option
    .Selectable()
    .Events(e => e.Change("onChange"))
    .Pageable(pageable => pageable
        .Refresh(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(15)
        .Model(model =>     <--- Add this
         {
           model.Id(m => m.Id);
           model.Field(m => m.Code);
           model.Field(m => m.Description);
         })
        .Read(read => read.Action("GetConcessions", "MasterData"))
    )
    )

See this DEMO : http://jsbin.com/emuqazEz/4/edit


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...