2017-09-26 94 views
1

当我在剑道网格UI中打开编辑器时,发生如下所示的错误。当在剑道网格UI中打开编辑器时发生datepicker错误

Uncaught TypeError: e.indexOf is not a function ..kendo.all.js:1179

if (value && value.indexOf('/D') === 0) { 
    date = dateRegExp.exec(value); 
    if (date) { 
     date = date[1]; 
     tzoffset = offsetRegExp.exec(date.substring(1)); 
     date = new Date(parseInt(date, 10)); 
     if (tzoffset) { 
      tzoffset = parseMicrosoftFormatOffset(tzoffset[0]); 
      date = kendo.timezone.apply(date, 0); 
      date = kendo.timezone.convert(date, 0, -1 * tzoffset); 
     } 
     return date; 
    } 
} 

我想这是有约束力的问题。

下面是我的代码片段。

  1. datasource schema。

    schema : { 
         model : { 
          id : "cid", 
          fields : { 
           cid : { 
            type : "number" 
           }, 
    
           meainInstDtm : { 
            type : "datetime" 
           }, 
    
          } 
         } 
    
  2. 剑道电网

    $("#grid").kendoGrid({ 
        dataSource : dataSource, 
        columns : [ { 
         field : "cid", 
         title : "CID" 
        }, { 
         field : "meainInstDtm", 
         title : "meainInstDtm",  
         width: 150, 
         editor: dateTimeEditor, 
         attributes: { 
          style: "text-align: center;" 
         } 
        }, { 
         command: [{name: 'edit'}, { name: 'destroy'}], title: " ", width:"180px", filterable:false 
        }], 
         editable: "popup" 
         }) 
    
  3. dateTimeEditor

    function dateTimeEditor(container, options) { 
         $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '" data-format="' + options.format + '"/>') 
         .appendTo(container) 
         .kendoDateTimePicker({}); 
        } 
    

我不知道是什么问题。帮我。

+0

if语句被调用的地方在哪里?检查我在这里做的道场,看看你是否可以重现这个问题:https://dojo.telerik.com/eVoNa/2 – MattOG

+0

@MattOG顶部的代码是kendo.js。 我不会调用if语句。 –

+0

你能提供一个我们可以测试的[jsFiddle](https://jsfiddle.net/)吗? –

回答

0

我将模式类型修改为date,并在编辑事件中添加了条件。这jsFiddle适合我。

+0

当它将'datetime'类型修改为'date'类型时,它会发生同样的错误... –

+0

Here:http://docs.telerik.com/kendo-ui/api/javascript/data/model#methods-Model。定义 状态的类型必须是日期,而不是日期时间: options.fields.fieldName.type字符串 指定字段的类型。可用的选项有“字符串”,“数字”,“布尔”,“日期”和“对象”。默认是“字符串”。 – MattOG

+0

试试这个[http://jsfiddle.net/v1e4kung/2/](http://jsfiddle.net/v1e4kung/2/)。我没有遇到错误。 –