"Added data does not match" with associative array, works with regular array
"Added data does not match" with associative array, works with regular array
devgreer
Posts: 9Questions: 0Answers: 0
I have datatables working with a regular array, i.e., one with no keys, but when I add keys, it gives me this error: "Added data does not match known number of columns".
The only thing I changed is the array. Here's the one that works:
{ "aaData": [
[
504,
"51d1dc9ddc757",
4,
"dmpdaleg",
"2",
"2013-07-01 14:46:36.471356",
14277448,
"logs.browse",
"index",
"BASE_LOG",
"[]"
]
] }
And here's the one that doesn't work:
{ "aaData": [
{
"id":504,
"request_id":"51d1dc9ddc757",
"user_id":4,
"client_name":"dmpdaleg",
"type":"2",
"time":"2013-07-01 14:46:36.471356",
"memory":14277448,
"object":"logs.browse",
"method":"index",
"category":"BASE_LOG",
"args":"[]"
}
] }
The javascript setup looks like this, a little stripped down for clarity:
[code]
oTable = jQuery("#data").dataTable({
sAjaxSource: Browse._get_url(),
aoColumns: [
{
bVisible: false,
bSearchable: false
},
{
"sClass": "control",
},
{},
{},
{},
{},
{},
{},
{},
{},
{},
]
});
[/code]
And the html looks like this:
[code]
Data ID
Request ID
User ID
Client
Type
Time
Memory
Object
Method
Category
Args
[/code]
The only thing I changed is the array. Here's the one that works:
{ "aaData": [
[
504,
"51d1dc9ddc757",
4,
"dmpdaleg",
"2",
"2013-07-01 14:46:36.471356",
14277448,
"logs.browse",
"index",
"BASE_LOG",
"[]"
]
] }
And here's the one that doesn't work:
{ "aaData": [
{
"id":504,
"request_id":"51d1dc9ddc757",
"user_id":4,
"client_name":"dmpdaleg",
"type":"2",
"time":"2013-07-01 14:46:36.471356",
"memory":14277448,
"object":"logs.browse",
"method":"index",
"category":"BASE_LOG",
"args":"[]"
}
] }
The javascript setup looks like this, a little stripped down for clarity:
[code]
oTable = jQuery("#data").dataTable({
sAjaxSource: Browse._get_url(),
aoColumns: [
{
bVisible: false,
bSearchable: false
},
{
"sClass": "control",
},
{},
{},
{},
{},
{},
{},
{},
{},
{},
]
});
[/code]
And the html looks like this:
[code]
Data ID
Request ID
User ID
Client
Type
Time
Memory
Object
Method
Category
Args
[/code]
This discussion has been closed.
Replies
Allan