Kendo Grid Custom Popup Dynamically Created

2 posts, 0 answers
  1. Steve
    Steve avatar
    22 posts
    Member since:
    Feb 2016

    Posted 17 Apr 2016 Link to this post

    Hi,

        Is it possible to create the custom popup editor dynamically?  I have a grid merging different objects would like like to change popup editor dynamically.  Usually, I used this form and it works fine:

    editable: {
        mode: "popup",
        template: kendo.template($("#allRequestEditGridTemplate").html()),
        confirmation:"@Html.Raw(@LocString["STR_DeleteConfirmation"])",
    },

    However, I would like use something like this and it does not work.  I got correct template shown, but no update button....

    edit: function (e) {
     
       var editWindow = this.editable.element.data("kendoWindow");
     
     
        if(e.model.CategoryType == 1 /*Document*/)
        {
                editWindow.content($("#docEditTemplate").html());
        }
        else if(e.model.CategoryType == 2 /*Piping*/)
        {
                editWindow.content($("#pipingEditTemplate").html());
        }
    }

     

    Thank you for your help

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 20 Apr 2016 Link to this post

    Hello Steve,

    Indeed this approach can cause some unexpected behavior. At this point (when edit event is fired) the content of the window already contains the update and cancel button and they are removed once you set new content. 

    Maybe a possible solution in this case is to contain both of the templates and hide one of them in the edit event. 

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top