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

Events on Grid.Editable.Window

1 Answer 995 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 06 May 2015, 08:27 PM
I am trying to get events to fire on a popup window used for the editor on a grid.  My code is below.  When I review the generated script, the .Window does not get configured with "Open" or "Activate".  Can anyone tell me what I need to do to get these events to fire?

 

@(Html.Kendo().Grid<FooRecord>()
    .Name("cFooGrid")
            .Columns(c =>
            {
                c.Bound(f => f.Foo);
                c.Bound(f => f.Bar);
                c.Bound(f => f.Bas);
                c.Command(a => a.Edit());
            })
            .Editable(e => e
                .Mode(GridEditMode.PopUp)
                .Window(w => w.Events(v => v.Open("OnEditStart").Activate(@<text>function () {console.log("EditWindow.Activate")}</text>)))
            )
            .ToolBar(t =>
            {
                t.Create();
            })
            .DataSource(ds => ds
                .Ajax()
                    .Create(r => r.Action("UpdateIndex", "Home"))
                    .Read(r => r.Action("IndexList", "Home"))
                    .Update(u => u.Action("UpdateIndex", "Home"))
                .Model( m => {
                    m.Id(f => f.Foo);
                })
            )
)

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 08 May 2015, 02:13 PM
Hi Tim,

In order to attach event handler to the Popup window you should use the Grid edit event. As an example: 
@(Html.Kendo().Grid<FooRecord>()
    .Name("cFooGrid")
    //....
    .Events(ev=>ev.Edit("onEdit"))
)
 
<script>
function onEdit(e) {
    e.container.data("kendoWindow").bind("activate", function () {
        //Your custom logic
    })
}
</script>
Keep in mind that the "open" event of the window cannot be used as it is already opened when the "edit" event of the grid is triggered.

Regards,
Iliana Nikolova
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or