asp.net-mvc - 如何在模式弹出窗口中使用 Kendo.Grid() 显示进度加载指示器?
问题描述
Grid
我在我的内部定义了一个Partial View
加载到模式弹出窗口中的内容。
这是的一部分Grid
:
@(Html.Kendo().Grid(Model.ReportReversalsData)
.Name("MyGrid")
.
.
.DataSource(ds => ds
.Ajax()
.Events(e => e.Error("ShowError"))
.Read(r => r.Action("MyMethod", "MyController", Model))
)
)
现在,每次数据加载时,我都想在 Grid 中插入一个进度加载指示器。
我试图定义一个在网格事件上showLoading
调用的 javascript 方法:RequestStart
.Events(e => e.Error("CheckError").RequestStart('showLoading'))
这是showLoading
功能和一些.css
样式所需的kendo.ui.progress
:
<style>
.k-grid-content > .k-loading-mask
{
visibility: hidden;
}
.k-grid > .k-loading-mask
{
z-index: 2;
}
.k-grid > .k-loading-mask > .k-loading-color
{
opacity: .7;
}
</style>
<script>
function showLoading()
{
kendo.ui.progress("#MyGrid", true)
}
</script>
但是,我收到一个错误:
对象不支持属性或方法“查找”
我错过了什么,或者我的方法完全错误,还有其他方法可以做到这一点?
解决方案
不要尝试使用纯文本 id,而是使用实际的 kendo 元素:
function showLoading()
{
var myGrid = $("#myGrid").getKendoGrid();
kendo.ui.progress(myGrid, true);
}
推荐阅读
- php - 黑客可以破解这个基本的 php url 查询检查吗?
- vue.js - 无法启动 Vue
- pytorch - 索引 Pytorch 张量
- node.js - Docker 无法访问 mariadb 服务器
- flutter - Flutter - 从列表视图中选择项目时“在构建期间调用 setState() 或 markNeedsBuild()”
- laravel - Laravel Nova 在更新时验证多个字段的唯一性
- java - 从文件中读取值并将它们拆分为两个带有 Java 流的列表
- angular - 角度火力一对一聊天。创作作品,检索不?
- c++ - 将 exr/pfm 保存到位图 CImg
- spring - 嵌套类中的配置属性