question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CDataTable: Table content doesn't support specifying the nested JSON in 'fields' props

See original GitHub issue

The CDataTable displays undefined for the column where the “key” is specified in nested JSON. ex:

App.js:

export default function App() {
  const data = usersData;
  const fields = [{
      key: "name",
      label: "Name"
    },{
      key: "available.status",
      label: "Available"
    }];

   return (
<CDataTable
         items={data}
         fields={fields}
    />
  );
}

usersData.js:

export const usersData = [
  {
    id: 0,
    name: "John Doe",
    available: {
      status: false
    }
  },
  {
    id: 1,
    name: "Samppa Nori",
    available: {
      status: true
    }
  },
  {
    id: 2,
    name: "Estavan Lykos",
    available: {
      status: false
    }
  },
  {
    id: 3,
    name: "Chetan Mohamed",
    available: {
      status: true
    }
  }
];

The column for “Available” is undefined.

Below you can find the link for working demo of the issue

Operating system and version: Windows 10 Pro Browser and version: All the browsers Reduced test cases : click here

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
shamvilkvcommented, Dec 27, 2020

@woothu Please help me with this issue

0reactions
github-actions[bot]commented, Jan 23, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

Read more comments on GitHub >

github_iconTop Results From Across the Web

CDataTable: Table content doesn't support specifying the nested ...
CDataTable : Table content doesn't support specifying the nested JSON in 'fields' props ... The CDataTable displays undefined for the column where the...
Read more >
Access nested JSON in React table - Stack Overflow
And it doesn't seem to contain ownerid . Try accessor: '_links.customer.href' to check whether it outputs anything to the table.
Read more >
DataTable - CoreUI
There are two ways to set columns by fields prop: -String: array item define column name equal to item key.
Read more >
Datatables get data from nested JSON Object
I was using principal.name to show the principal name on my table, but it's not working. the detail of the code is below...
Read more >
RichFaces Developer Guide - JBoss.org
For example: if we use a4j:support on an input field and ... RichFaces allows to serialize not only primitive types into JSON format,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found