虽然没有错误,但弹出窗口没有显示

时间:2014-06-07 04:15:20

标签: javascript jquery html5 kendo-ui

我正在尝试显示一个包含kendo templatekendowindow值的弹出窗口。虽然没有错误,但以下代码未显示弹出窗口和模板内容。知道需要更改什么来显示这个吗?

更新

当我删除了msie浏览器检查时弹出窗口。但它仍然没有显示模板内容。我错过了什么吗?

我提到了以下堆栈溢出帖子和许多其他博客来解决这个问题。

  1. Filtering source in a Kendo Template
  2. select and show in new window Kendoui grid row data?
  3. Creating a div element in jQuery
  4. browser.msie error after update to jQuery 1.9.1
  5. CODE

     <head>
        <title>Kendo Template and Kendo Window</title>
        <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>
    
    
    
     <!---- lijo   Kendo Templates-->
        <script id="row-template" type="text/x-kendo-template">
              <tr>
                    <td data-bind="text: name"></td>
                    <td data-bind="text: age"></td>
              </tr>
        </script>
    
    
    <script type="text/javascript">
    
        //lijo
        $(document).ready(function () {
    
    
            var viewModel = kendo.observable({
    
                employees: [
                            { name: "Lijo", age: "28", IsSelected: true },
                            { name: "Binu", age: "33", IsSelected: false },
                            { name: "Kiran", age: "29", IsSelected: true }
                           ]
            });
    
            kendo.bind($("body"), viewModel);
        });
    
    
    
        //lijo
        function showMakeAndHold() {
    
            alert("HIIIIIII");
    
            var drilldownpopup = $('<div class="myClass">A</div>');
    
    
    
            if (!drilldownpopup.data('kendoWindow')) 
            {
                drilldownpopup.kendoWindow({
                        modal: true
                    });       
            }
    
            drilldownpopup.data('kendoWindow').title(" ");
            $('.k-window-actions').html('<span class="titletext">' + "MAKE HOLD BALANCE ITEM" + '</span><a href="#" class="k-window-action k-link"><span class="k-icon k-i-close"></span></a>');
    
            var myString =
                           ['<html><body><table id="resultTable">',
                                '<tbody data-template="row-template" data-bind="source: employees">',
                                '</tbody>',
                            '</table>AAAA</body></html>'
                           ].join('\n');
    
    
            drilldownpopup.data('kendoWindow').content(myString);
    
            drilldownpopup.data('kendoWindow').open();
            drilldownpopup.data('kendoWindow').center();
    
        }
    
    
    
     </script>
    
    
    
    
    </head>
    
    <body>
    
    A   B 
    
     <button id = "MakeHoldDetailLinkButton" class="MakeHoldDetailLinkButton" onclick = "showMakeAndHold();">View Make Hold</button> 
    
    <div class="drilldownwindow">SS</div>
    
    </body>
    

1 个答案:

答案 0 :(得分:1)

尝试以下代码:

1)你在准备好的职能中提到员工,所以在你的myString html代码运行之后首先运行它所以它dosnt显示员工数据,所以删除就绪函数把代码放在下面..

 <head>
    <title>Kendo Template and Kendo Window</title>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>



 <!---- lijo   Kendo Templates-->
    <script id="row-template" type="text/x-kendo-template">
          <tr>
                <td data-bind="text: name"></td>
                <td data-bind="text: age"></td>
          </tr>
    </script>


<script type="text/javascript">

    //lijo








    //lijo
    function showMakeAndHold() {

       // alert("HIIIIIII");

        var drilldownpopup = $('<div class="myClass">A</div>');



        if (!drilldownpopup.data('kendoWindow')) {
           if (jQuery.support.leadingWhitespace) {
                drilldownpopup.kendoWindow({
                    animation: false,
                    modal: true
                });

            }
            else {
                drilldownpopup.kendoWindow({
                    modal: true
                });
            }
        }

        drilldownpopup.data('kendoWindow').title(" ");
        $('.k-window-actions').html('<span class="titletext">' + "MAKE HOLD BALANCE ITEM" + '</span><a href="#" class="k-window-action k-link"><span class="k-icon k-i-close"></span></a>');

        var myString =
                       ['<html><body><table id="resultTable">',
                            '<tbody data-template="row-template" data-bind="source: employees">',
                            '</tbody>',
                        '</table></body></html>'
                       ].join('\n');


        drilldownpopup.data('kendoWindow').content(myString);

        drilldownpopup.data('kendoWindow').open();
        drilldownpopup.data('kendoWindow').center();


    var viewModel = kendo.observable({

            employees: [
                        { name: "Lijo", age: "28", IsSelected: true },
                        { name: "Binu", age: "33", IsSelected: false },
                        { name: "Kiran", age: "29", IsSelected: true }
                       ]
        });

        kendo.bind($("body"), viewModel);



    }



 </script>




</head>

<body>

A   B 

 <button id = "MakeHoldDetailLinkButton" class="MakeHoldDetailLinkButton" onclick = "showMakeAndHold();">View Make Hold</button> 

<div class="drilldownwindow">SS</div>

</body>