This is a migrated thread and some comments may be shown as answers.

[Solved] Change grid edit mode on client side

0 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sergey Popov
Top achievements
Rank 1
Sergey Popov asked on 29 Feb 2012, 02:50 AM
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. I add new custom command in toolbar and call javascript function Add2, where try change grid edit mode. 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.
Tags
Grid
Asked by
Sergey Popov
Top achievements
Rank 1
Share this question
or