当从带有OData元数据包装器的Web API 2.2 OData v4控制器返回数据时,我无法在JQuery DataTables中的枚举数据集中正确获取列。没有错误,只是"表中没有可用的数据"初始化后。
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"
}
数据表列初始化:
"columns": [
{ "data": "value.ShipmentKey" },
]
也尝试过:
"columns": [
{ "data": "value..ShipmentKey" },
]
答案 0 :(得分:0)
我明白了,我需要使用dataSrc来指定" value"在我的ajax设置中。
$('#blah').dataTable({
"ajax": {
"url": 'http://localhost/blahblahblah/SearchData',
"dataSrc": 'value'
},
"columns": [
{ "data": "ShipmentNumber" },