Kendo UI网格将日期列数据导出为###############

时间:2015-10-20 10:02:08

标签: user-interface kendo-ui grid

****示例:http://jsfiddle.net/o8cw3vj8/12/ 我正在尝试导出kendo ui网格和网格有日期列,导出时只包含############ ...当日期年份小于或等于1900时 谢谢,****

 $("#grid1").kendoGrid({
   toolbar: ["excel"],
   excel: {
     fileName: "Kendo UI Grid Export.xlsx",
     proxyURL: "http://demos.telerik.com/kendo-ui/service/export",
     filterable: true
   },
   dataSource: {
     data: [{
       "Id": 1,
       "Name": "John",
       "DOB": "01/01/1753"
     }, {
       "Id": 2,
       "Name": "Joe",
       "DOB": "01/01/1953"
     }, {
       "Id": 3,
       "Name": "Jack",
       "DOB": "01/01/1940"
     }],
     schema: {
       model: {
         fields: {
           Id: {
             type: "number"
           },
           Name: {
             type: "string"
           },
           DOB: {
             type: "date"
           }
         }
       }
     }
   },

   columns: [
     "Id", "Name", "DOB"
   ]
 });

1 个答案:

答案 0 :(得分:0)

如果您将鼠标悬停在单元格上,您将看到一条消息"日期和时间为负数或太大显示为#####"。这是一个截图:

enter image description here

这是因为Excel saves dates as numbers of days after 1/1/1990。在您的情况下,数字变为负数,因此显示。