I would like to use DynamicTable from Atlaskit in my Forge Custom UI app, but have challenges to get it running. I tried to create a basic example with static content, but still nothing is rendered and I don’t find related error messages.
Here is my code. My actual test data looks like this.
const testdata = [
{id:1, testtext: "Eins"},
{id:2, testtext: "Zwei"}
];
In order to translate that into rows for DynamicTable I understood, I need to create something like this. Is that correct?
const testrows = [
{
key: '1',
cells: [
{
key: 'id-1',
content: '1',
},
{
key: 'testtext-1',
content: 'Eins',
}
]
},
{
key: '2',
cells: [
{
key: 'id-2',
content: '2',
},
{
key: 'testtext-2',
content: 'Zwei',
}
]
}
];
My header definition looks like this. Is this in correct structure?
const head = {
cells: [
{
key: "id",
content: "ID",
},
{
key: "testtext",
content: "Test Text",
}
]
};
Then I am using this in App.js together with DynamicTable, but nothing is rendered.
import DynamicTable from '@atlaskit/dynamic-table';
function App() {
const head = ...
const testrows = ...
return (
<div>
<DynamicTable
head={head}
rows={testrows}
/>
</div>
);
}
export default App;
Any idea why nothing is rendered?
I guess I am doing a mistake in the definition of head or testrows?