简体   繁体   English

Telerik MVC网格。 如何在客户端更改网格编辑模式?

[英]Telerik MVC Grid. How to change grid edit mode on client side?

I need custom grid behavior on client side: on press Add button, grid create new row in InLine mode, and on press Add2 button, grid create new row in InForm mode, with additional functionality. 我需要在客户端上自定义网格行为:在按添加按钮时,网格以InLine模式创建新行,并在按Add2按钮时,网格以InForm模式创建具有附加功能的新行。 I add new custom command in toolbar and call javascript function Add2, where try change grid edit mode. 我在工具栏中添加了新的自定义命令,并调用了javascript函数Add2,在其中尝试更改网格编辑模式。 But edit mode not changed, new row created in InLine mode. 但是编辑模式未更改,新行以内联模式创建。 What I do wrong, and in general, is it possible? 我做错了,总的来说,可能吗?

<script type="text/javascript">
    function Add2() {
        var grid = $('#Property').data('tGrid');
        grid.editing.mode = 'InForm';
        grid.addRow();
    }
</script>

Html.Telerik().Grid<Models.PropertyTypeModel>().Name("Property")
            //  skip
            .DataBinding(dataBinding =>
            {
                dataBinding.Ajax()
                    .Select("_PropertySelect", "Options", new { oid = "<#= OptionTypeID #>" })
                    //  skip
            })
            .ToolBar(commands => 
            {
                commands.Insert().ButtonType(GridButtonType.ImageAndText);
                commands.Custom().Text("Add2").Url("javascript:void(0)").HtmlAttributes(new { onclick = "Add2()" });
            })
            .Editable(editing => editing
                .Mode(GridEditMode.InLine)
            )
)

Thanks in advance for your reply. 预先感谢您的答复。

当前不支持此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM