我有网格配置使用Popup在Ajax上附加Kendo Button,它应该用一些数据打开Kendo Window . 问题是Window已打开,但我发送的数据是 undefined . 看看我的配置:

$('#grid').kendoGrid({
     ...
    editable: {
      mode: 'popup',
      },
      template: $('#popup_editor').html(),
    edit: function (e) {
       ...
       $.ajax({
          ...
       }).success(function (data) {
          ...
          $('#print-edit').kendoButton({
              click: function (e) {
                openWindowEdit2()
              },
          })
        })
     }

    function openWindowEdit2 () {
      $("#dialogEdit").kendoWindow({
          actions: [
            'refresh',
            'Close'
          ],
          visible: false,
          content: {
            dataType: 'json',
            iframe: false,
            template: $('#tmpPrint').html()
          }
        }
      );
      var window2 = $('#dialogEdit').data("kendoWindow");
      window2.refresh({
        url: API_URL + 'frank/bankcontractget/' + 97,
        dataType: "json",
        template: $('#tmpPrint').html()
      });
      window2.open().center()
    }


//contract_edit.php

    <script id="popup_editor" type="text/x-kendo-template">
        ...
        <div id="dialogEdit">
            <script type="x/kendo-template" id="tmpPrint">
                <input type="text" class="k-input k-textbox"
                       value="#= data.agent_number #"
                />
            <\/script>
        </div>
    </script>

结果:“未定义”


如果检索到的数据在模板属性中内联传递,则它有效 . 窗口打开,字符串“Hello,FOO”:

...
  window2.refresh({
    url: API_URL + 'frank/bankcontractget/' + 97,
    dataType: "json",
    template: "Hello, #= agent_number # "
  });
  ...

结果:“你好,FOO”