2012-02-29 52 views
0

我需要客户端的自定义网格行为:按下Add按钮,网格在InLine模式下创建新行,然后按Add2按钮,网格在InForm模式下创建新行,并具有附加功能。我在工具栏中添加新的自定义命令并调用javascript函数Add2,其中尝试更改网格编辑模式。但编辑模式未更改,在InLine模式下创建新行。我做错了什么,总的来说,这有可能吗?Telerik MVC Grid。如何在客户端更改网格编辑模式?

<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) 
      ) 
) 

在此先感谢您的答复。

回答

0

目前不支持。

相关问题