单击网格中的按钮,如何在kendo ui网格中动态更改编辑模式(弹出+内联)? [英] How to change edit mode(pop-up+inline) dynamically in kendo ui grid on click of button in grid?

查看:47
本文介绍了单击网格中的按钮,如何在kendo ui网格中动态更改编辑模式(弹出+内联)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mvc4应用程序.在我的一个页面上,我正在使用kendo网格.我想添加两个用于编辑的按钮,一个用于在弹出窗口中进行编辑,而另一个用于内联编辑.

I am using mvc4 application .On one of my page i am using kendo grid.I want to add two buttons for editing, one is used for editing in pop-up and other for inline editing.

我想在单击按钮时动态更改网格编辑模式.

I want to change the grid edit mode dynamically on click of button.

有人可以帮我吗?

推荐答案

如果要动态更改Grid中所有行的编辑模式,可以执行以下操作:

If you want to change dynamically the edit mode for all rows in a Grid you can do:

ButtonGrid定义:

<a href="#" id="popup" class="k-button">Popup</a>
<a href="#" id="inline" class="k-button">Inline</a>
<div id="grid"></div>

Grid初始化:

var grid = kendoGrid({
    dataSource: dataSource,
    columns: [
        { command: ["edit", "destroy"], title: "&nbsp;" },
        { field: "field1", title: "Field1" },
        { field: "field2", title: "Field2" },
    ],
    editable  : "popup"
}).data("kendoGrid");

Buttons初始化:

$("#popup").on("click", function () {
    grid.options.editable = "popup";
});
$("#inline").on("click", function () {
    grid.options.editable = "inline";
});

单击这些按钮中的任何一个时,都将编辑模式选择为inlinepopup.

When you click on either of these buttons, you select the edit mode as inline or popup.

这篇关于单击网格中的按钮,如何在kendo ui网格中动态更改编辑模式(弹出+内联)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆