2012-11-13 109 views
0

这里是一个jsfiddle(不是我的,但同样的错误)。 http://jsfiddle.net/grenal/KGsSL/73/Kendo UI Grid自定义弹出模板解除绑定错误

<script id="popup_editor" type="text/x-kendo-template"> 
<table width="600" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
    <th width="197" scope="row">Chapter Name</th> 
    <td width="403"><label for="chapterName"></label> 
    <input type="text" name="chapterName" id="chapterName" data-bind="source: chaptername"></td> 
    </tr> 
    <tr> 
    <th scope="row">State</th> 
    <td><label for="state"></label> 
    <input type="text" name="state" id="state" data-bind="source: state"></td> 
    </tr> 
<tr> 
    <th scope="row">Code</th> 
    <td><label for="code"></label> 
    <input type="text" name="code" id="code" data-bind="source: code"></td> 
    </tr> 
    <tr> 
    <th scope="row">Date Added</th> 
    <td><label for="dateadded"></label> 
    <input type="text" name="dateadded" id="dateadded" data-bind="source: dateadded"></td> 
    </tr> 
    <tr> 
    <th scope="row">Active</th> 
    <td><label for="active"></label> 
    <input type="text" name="active" id="active" data-bind="source: active"></td> 
    </tr> 
    <tr> 
    <th scope="row">&nbsp;</th> 
    <td>&nbsp;</td> 
    </tr> 
    <tr> 
    <th scope="row">Approved</th> 
    <td><label for="approved"></label> 
    <input type="text" name="approved" id="approved" data-bind="source: approved"></td> 
    </tr> 
<tr> 
    <th scope="row">Chapter Price</th> 
    <td><label for="chapterPrice"></label> 
    <input type="text" name="chapterPrice" id="chapterPrice" data-bind="source: chapterPrice"></td> 
    </tr> 
<tr> 
    <th scope="row">Parent Price</th> 
    <td><label for="parentPrice"></label> 
    <input type="text" name="parentPrice" id="parentPrice" data-bind="source: parentPrice"></td> 
    </tr> 
</table> 
</script>​ 

  $(document).ready(function() { 


       $("#search").click(function() { 
        // alert("clicked refresh"); 
        $("#grid").data("kendoGrid").dataSource.read(); 
       });     


       $("#grid").kendoGrid({ 
        dataSource: { 


         transport: { 
           read: { 
             url: "chaptersJson.cfm", 
             dataType: "json", 
             data: {q: function() { return $("#chapterName").val();}} 
           }, 
          update: { 
            url: "chaptersJson.cfm?pageaction=Update", 
            dataType: "json" 
           } 

         }, 
         schema: { 
          model: { 
           id: "chapterid", 
           fields: { 
            chapterid: { type:"number" }, 
            chaptername: { type: "string" }, 
            active: {type: "string"}, 
            approved: {type: "string"}, 
            chapterPrice: {type: "string"}, 
            parentPrice: {type:"string"}, 
            code: {type:"string"}, 
            dateadded: {type:"date"}, 
            state: {type:"string"} 

           } 
          } 
         }, 
         pageSize: 25 
        }, 
        height: 500, 
        filterable: false, 
        sortable: true, 
        pageable: true, 
        columns: [{field: "chaptername", title: "Chapter", width: 200}, 
           {field: "state", title:"State", width: 100}, 
           {field: "chapterPrice", title:"Chapter Price", width: 100}, 
           {field: "parentPrice", title:"Parent Price", width: 100}, 
           {field: "dateadded", title:"Added On", width: 100, template: '#= kendo.toString(dateadded,"MM/dd/yyyy") #'}, 
           {command: ["edit"], title:"&nbsp;", width:"210px"} 
        ], 
        editable: {mode: "popup", template: $("#popup_editor").html()} 
       }); 
      }); 
     </script> 

当您尝试打开弹出式窗口,然后单击X关闭或取消按钮,它不关闭并返回:

遗漏的类型错误: - ----------有没有方法'取消绑定'

我基本上用KendoUI创建一个规则的网格,但我想要一个自定义弹出窗口编辑器来显示更多的网格目前所做的字段。

+0

popup_editor html是什么样子的? –

+0

感谢您的回复。我更新了上面的代码以包含它。我仿效了我看到的另一个例子。 – steve

回答

1

更新版本和错误应该消失(因为它是固定的)。

基本上你只需要改变脚本和样式的引用指向913版本,而不是710

例如

<script src="http://cdn.kendostatic.com/2012.2.913/js/kendo.core.min.js"></script> 
+0

感谢您的回复。今天早上我更新了他们刚刚发布的新测试版,它修复了我的一半问题。该窗口现在将关闭,但控制台仍显示Uncaught TypeError:Object(field value)没有方法'unbind'。现在至少它关闭了,我会努力完成我的脚本的更新,并添加并看看我可以从哪里拿到它。 – steve

+0

:)今天有正式发布,所以你不需要再使用Beta了 –