Handling events from a Kendo MVC Grid's PopUp editor window

前端 未结 1 1281
醉酒成梦
醉酒成梦 2021-01-25 06:31

I have a Kendo MVC grid that I am creating with the Html.Kendo().Grid helper. When the PopUp editor window opens, I want to catch the event and run a bit of javascript. When I

相关标签:
1条回答
  • 2021-01-25 07:28

    The "events" of the kendo grid popup are not honoured/serialized (at least not the last time I tested this back in 2014) and so you should use the grid's Edit event to control the "Pop Up" window events

    So within your grid add this:

    .Events(event => event.Edit("onEdit"))
    .//other grid settings here. 
    

    Then add a javascript function like this:

    function onEdit(e) {
    
        //get window object
        var kendoWindow = e.container.data("kendoWindow");
    
            kendoWindow.setOptions({
                title: "I have a custom Title"
    
                //do stuff in here 
    
            });
    
    
    }
    

    Then you can apply what ever functions you want to the window via javascript.

    I do something similar to this to resize the pop up editor so it takes up 80% of the screen size regardless of the display/device.

    If you have something more specific you are after then I will update my answer accordingly.

    edit: If you want you can refer to this post from Telerik's own forums which is what I used when I first encountered this issue back in mid 2014.

    Kendo Pop Up Editor not firing off applied events

    0 讨论(0)
提交回复
热议问题