我需要在客户端自定义网格行为:按下Add按钮,网格在InLine模式下创建新行,按Add2按钮,网格在InForm模式下创建新行,并具有附加功能。我在工具栏中添加了新的自定义命令,并调用javascript函数Add2,其中尝试更改网格编辑模式。但是编辑模式没有改变,在InLine模式下创建了新行。我做错了什么,一般来说,这是可能的吗?
<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)
)
)提前感谢您的回复。
发布于 2012-03-25 17:03:14
目前不支持此功能。
https://stackoverflow.com/questions/9507036
复制相似问题