正在使用Kendo UI,我的目标是在重新加载页面或重定向时保留kendo-grid过滤器,我可以在重新加载/重定向页面后保留过滤器,但是面临问题在下面提到,
//Edit button column in kendo:
columns.Command(command =>
{
command.Custom(Resources.VerificationEntries.txtEdit).Click("show");
command.Destroy().Text(Resources.Kendo.txtDel);
}).Width(200).HtmlAttributes(new { });
}
//code logic to save the filter to local storage
$(document).ready(function () {
$("#gridEntries").data("kendoGrid").setOptions(JSON.parse(localStorage["GridSettings"]));
});
function grid_dataBound() {
localStorage.clear('GridSettings');
localStorage["GridSettings"] = kendo.stringify($("#gridEntries").data("kendoGrid").getOptions());
}
//On click of edit
function show(e) {
grid_dataBound();
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var vID = dataItem.VID;
window.location.href = '@Url.Action("Update", "Vest")?VID=' + vID;
}
请帮助。
也许使用command.Edit而不是command.Custom会更有帮助。然后,您可以添加Events(e=e>Edit("show"))
以使用Javascript函数。
关于编辑,有一个“编辑”模式/事件,用户输入其更改,然后有一个“保存”模式/事件,其中数据实际上已发送到控制器。您可能想要加入保存事件,而不是进行编辑。我也怀疑您的e.preventDefault();
可能是电网中断的一部分。
[如果要查找整个单独的窗口,则可以执行列自定义模板,在其中添加按钮(通过html),该按钮具有javascript函数,可以在其中传递任何模型值,例如vID。
您想通过编辑按钮完成什么?