2015-02-09 69 views
1

從Web API 2.2 OData v4控制器和OData元數據包裝器返回數據時,我在JQuery DataTables中枚舉數據集中的列正確找到列時遇到問題。沒有錯誤,只是「初始化後沒有可用的數據表」。JQuery DataTables和Web API 2 OData列嵌套數組數據源

AJAX響應:

{ 
    "odata.metadata":"http://localhost/blahblahblah/$metadata#SearchData","value":[ 
    {"ShipmentKey":"12345"}, 
    {"ShipmentKey":"12346"}, 
    {"ShipmentKey":"12347"}, 
    {"ShipmentKey":"12348"}, 
    ],"odata.nextLink":"http://localhost/blahblahblah/SearchData?$skip=100" 
} 

數據表列intialiation:

"columns": [ 
       { "data": "value.ShipmentKey" }, 
      ] 

也試過:

"columns": [ 
        { "data": "value..ShipmentKey" }, 
       ] 

回答

0

我明白了,我需要使用DATASRC在指定 「值」我的ajax設置。

$('#blah').dataTable({ 
    "ajax": { 
     "url": 'http://localhost/blahblahblah/SearchData', 
     "dataSrc": 'value' 
    }, 
    "columns": [ 
     { "data": "ShipmentNumber" },