Nested object data
Nested object data
Hi, I ref link https://datatables.net/examples/ajax/deep.html, so I have a question.
Example:
"columns": [
{ "data": "name" },
{ "data": "hr.position" },
{ "data": "contact.0" },
{ "data": "contact.1" },
{ "data": "hr.start_date" },
{ "data": "hr.salary" }
]
But when I want to add class 'text-center' for 'name' column. I must use:
'columnDefs' : [
{
'targets' : 0,
'className': 'text-center'
},
]
I want to use something as:
'targets' : 'name',
Can it?
Replies
Hi @tranhuuhien1990 ,
No,
columnDefs.targets
doesn't support named fields, see what it can on that linked page.But, you can just specify the class in the
columns
, it doesn't need to be separate:Cheers,
Colin
Thank you for rely me!