2014-03-12 49 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,