问题描述
我正在使用kendo网格,它们适用于CRUD操作。现在,我想通过在网格规范中添加 .Filterable()
选项来添加过滤。以下是一些代码:
< div id =datagrid>
@(Html.Kendo()。Grid< SustIMS.Models.ConcessionModel>()
.Name(datagrid_Concessions)
.Columns(columns =>
{
columns.Bound(c => c.Code)。标题(代码);
columns.Bound(c => c.Description)。标题(描述);
columns.Bound(c => c.TrafficOpeningDate)。标题(交通开放日期);
columns.Bound(c => c.CreationDate)。标题(创建日期);
})
.HtmlAttributes(new {style =height:534px;})
.Filterable()//这里是可过滤的选项
.Selectable()
。事件(e => e.Change(onChange))
.Pageable(pageable => pageable
.Refresh(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.Read(read => read.Action(GetConcessions,MasterData))
)
)
< / div>
网格呈现完美,现在网格列标题上显示的小过滤器图标:
javascript运行时错误:对象不支持属性或方法'addBack'
。 此外,它会打开文件 kendo.all.min.js
,并在一行代码中突出显示方法 addBack
是。
注意:我在Chrome和Firefox上测试过它的确有效精细。该问题仅在使用Internet Explorer(版本11)时存在。
任何帮助?
确保你有 Jquery-1.8.1.min.js
或更高版本的 jquery
在你的页面中。因为 addBack
被添加到 1.8
。
试试这样,
@(Html.Kendo()。Grid< SustIMS.Models.ConcessionModel>()
.Name(datagrid_Concessions)
.Columns(columns =>
{
columns.Bound(c => c.Code).Title(Code);
columns.Bound(c => c.Description)。标题(描述);
columns.Bound(c => c.TrafficOpeningDate)。标题(交通开放日期);
columns.Bound(c => c.CreationDate)。标题(创建日期);
})
.HtmlAttributes(new {style =height:534px;})
.Filterable()//这里是可过滤的选项
.Selectable()
.Events(e => e.Change(onChange ))
.Pageable(pageable => pageable
.Refresh(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.Model(model => ;< ---添加此
{
model.Id(m => m.Id);
model.Field(m => m.Code);
model.Field(m => m.Description);
})
.Read(read => read.Action(GetConcessions,MasterData))
)
)
查看此演示:
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:
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 withjavascript 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?
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
这篇关于Javascript运行时错误:“对象不支持属性或方法”在Internet Explorer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!