DataTables----Cannot read property 'length' of undefined

Cannot read property 'length' of undefined

除了网上说的column数量要和一样外,还有一个,dataTable只接受数组类型的数据.

Array of arrays

data: [  
                    [  
                        "name":    "Tiger Nixon1",  
                        "position":   "System Architect1",  
                        "phone": { "plain": 5552368, "filter": "5552368 555-2368", "display": "555-2368" ],  
                        "salary":    "$3,1201",  
                        "start_date": "2011/04/25",  
                        "office":    "Edinburgh1",  
                        "extn":    "54211"  
                    ],  
                    [  
                        "name":    "Tiger Nixon2",  
                        "position":   "System Architect2",  
                        "phone": { "plain": 5552368, "filter": "5552368 555-2368", "display": "555-2368" },  
                        "salary":    "$3,1202",  
                        "start_date": "2011/04/25",  
                        "office":    "Edinburgh2",  
                        "extn":    "54212"  
                    ],  
                    [  
                        "name":    "Tiger Nixon3",  
                        "position":   "System Architect3",  
                        "phone": { "plain": 5552368, "filter": "5552368 555-2368", "display": "555-2368" },  
                        "salary":    "$3,1203",  
                        "start_date": "2011/04/25",  
                        "office":    "Edinburgh3",  
                        "extn":    "54213"  
                    ] 

或者

Array of objects

"data":[
    {"":"",
    "":"",
     "":""
    },
    {"":"",
    "":"",
     "":""
    }
]

最后注意,返回值实体 Result.data = EntityList。 要放在名为data的字段里。

原文地址:https://www.cnblogs.com/wtjqs/p/13079635.html