Kar*_*idi 1 c# asp.net-mvc kendo-ui
我正在使用asp.net mvc 3.我正在尝试使用kendo mvc ui grid显示记录列表.我已将可编辑模式设置为弹出,因此可以在服务器上完成处理.我希望在数据加载到网格之前显示加载图像,这意味着在分页,刷新等过程中我已经使用了网格
@(Html.Kendo().Grid(Model)
.Name("GrdXXX")
.HtmlAttributes(new { style="width:1000px;" })
.Columns(columns =>
{
columns.Bound(p => p.xxx).Width(50);
columns.Bound(p => p.yyy).Width(50);
columns.Bound(p => p.zzz).Width(80);
columns.Bound(p => p.State).Width(50);
columns.Bound(p => p.Phone).Width(70);
columns.Command(command => { command.Edit().Text("Edit Details"); command.Destroy().HtmlAttributes(new { onclick = "return DeleteConfirm();" }); }).Width(120);
})
.ToolBar(toolbar => toolbar.Create().Text("Add New Zip Code"))
.Editable(editable => editable.Mode(GridEditMode.PopUp).Window(m => m.Title("Edit Zipcode").Draggable().Resizable()))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(p => p.RecNo))
.Update("Update", "ghj")
.Create("Create", "ghj")
.Destroy("Delete", "ghj")
)
)
Run Code Online (Sandbox Code Playgroud)
我尝试过使用ajax jquery调用,但它对我不起作用.所以请指导我.
这就是我通过扩展jQuery明确地向Kendo网格添加加载效果的方法.它使用原生的剑道造型.
$.extend($.fn, {
busy: function (c) {
b = $(this);
var d = b.find(".k-loading-mask");
c ? d.length || (d = $("<div class='k-loading-mask'><span class='k-loading-text'>Loading...</span><div class='k-loading-image'/><div class='k-loading-color'/></div>").width(b.outerWidth()).height(b.outerHeight()).prependTo(b)) : d && d.remove()
}
});
Run Code Online (Sandbox Code Playgroud)
然后用它作为
$("#grid").busy(true); // change to false to hide loading effect
Run Code Online (Sandbox Code Playgroud)