如何在Kendo UI中的kendo-template脚本中使用kendo-template脚本?

时间:2018-07-09 10:44:38

标签: kendo-ui telerik kendo-grid

我需要在Grid Popup Editor中使用Window组件。甚至可以在弹出窗口中创建弹出窗口吗?另一个剑道模板脚本中的剑道模板脚本?

我具有使用弹出式窗口的网格配置,该弹出式窗口在Ajax上附加了剑道按钮,该剑道应该使用一些数据打开剑道窗口。问题是打开了窗口,但是我发送到那里的数据是未定义。看一下我的配置:

 $('#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()
    }




   //php file with grid

       <div id="grid"></div>
       <script id="popup_editor" type="text/x-kendo-template">
           <?php require_once('./src/contract_edit.php'); ?>
       </script>


//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”

0 个答案:

没有答案
相关问题