2014-03-12 47 views
1

我有一个Kendo UI网格,在IE10/11/Chrome/Firefox中绝对正常。但是,在IE8/9中,它完全无法渲染任何返回的数据。它连接到OData Web Api 2端点。这里是JavaScript:Kendo UI Grid并不在IE8和IE9中显示任何数据

$(document).ready(function() 
{ 
    $("#grid").kendoGrid({ 
     dataSource: { 
      transport: { 
       read: "http://cross_site_url:port/api/TrackedContainers/get" 
      }, 
      pageSize: 15, 
      sort: { field: "EventTime", dir: "desc" } 
       }, 
     filterable: true, 
     sortable: true, 
     pageable: true, 
     columns: [ 
      { field: "QrCode", title: "QR Code", width: 100 }, 
      { field: "Type", title: "Type", width: 150 }, 
      { field: "Location", title: "Location", width: 200 }, 
      { field: "Status", title: "Status", width: 90 }, 
      { field: "FailedCollectionReason", title: "Failed Collection Reason", width: 150 }, 
      { 
       field: "EventTime", 
       title: "Event Time", 
       type: "date", 
       format: "{0:dd-MMM-yyyy hh:mm:ss tt}", 
       parseFormats: ["yyyy-MM-dd'T'HH:mm:ss.zz"], 
       width: 150 
      } 
     ] 
    }); 
}); 

这一次,IE11的兼容模式似乎准确地模拟现实世界,也未能在设定为IE8文档模式,以显示任何结果。上面的网址显然不是真正的网址 - 它会发起跨站点呼叫,因此我试图在IE8中启用XSS,但无济于事。添加到受信任的站点也没有任何区别。

看看网络流量吧,看起来网格甚至不会在IE8/9中尝试HTTP GET。

任何想法?

+1

您是否将CORS传输添加到jQuery? IE8和9需要使用XDomainRequest对象来执行未包含在jquery中的CORS请求。 –

+1

在document.ready上方,添加$ .support.cors = true; –

+0

这是问题所在。通过添加上述内容来修复。非常 –

回答

2

你加一个CORS运输jQuery的? IE8和9需要使用 XDomainRequest对象来执行不包含在jquery中的 的CORS请求。 - Kevin B 41分钟前

在document.ready之上,添加$ .support.cors = true; - Robin Giltner 53秒前

上面修好了,谢谢你们。

0

您需要添加数据类型:JSON在你的数据源

transport: { 
     read: { 
      url: "/api/request/GetUrcs", 
      dataType: "json" 
     } 
    }, 
    batch: false,