Open window where content source contains template

2 posts, 1 answers
  1. Peter
    Peter avatar
    1 posts
    Member since:
    Dec 2010

    Posted 07 Aug 2012 Link to this post

    I'm trying to open a window where content page has uses a template to display the data.
    The content page it self works fine just entering the url but when I try to open it as a window nothing happens.
         var window = $("#window");
        
       window.kendoWindow({
            width: "505px",
            height: "315px",
            title: "Mail",
            actions: ["Refresh", "Maximize", "Close"],
            content:"inbox/getemail.aspx?msgid="+msgid,
            iframe:false
        });
     
        window.data("kendoWindow").open();

    //content page 
    script language="javascript">
     
    var messageData;
     
    $.fn.getMessageData = function(){
         
        messageData =
        {      
            time:'2012-07-26 12:34:50',
            sender:'test@test.com',
            subject:'Testing message data'     
        };
    };
     
    $(function(){  
        var template = kendo.template($("#template").html());
        $.fn.getMessageData();     
        $("#preview").html(template(messageData));
            
    });
     
    </script>
     
    <script type="text/x-kendo-template" id="template">
        <h3>#= subject #</h3>
        <h4>posted on #= time # by <strong>#= sender #</strong></h4
    </script>
     
     <div id="preview"></div>
  2. Answer
    John DeVight
    John DeVight avatar
    209 posts
    Member since:
    Jan 2010

    Posted 10 Aug 2012 Link to this post

    Hi Peter,

    Looking at the source code for the window, the content gets loaded using jQuery.ajax.  The problem with jQuery.ajax in your case is that it will not execute any javascript.  A suggestion would be to initialize the window and then load the contents using jQuery.load.

    var window = $("#window");
      
    window.kendoWindow({
        width: "505px",
        height: "315px",
        title: "Mail",
        actions: ["Refresh", "Maximize", "Close"],
        iframe:false
    });
      
    window.load("inbox/getemail.aspx?msgid="+msgid);
      
    window.data("kendoWindow").open();

    Regards,

    John DeVight
  3. Kendo UI is VS 2017 Ready
Back to Top