Smartable/demo/DemoTable.tsx

72 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-07-24 17:46:26 +02:00
import React from "react";
import {createSmartable} from "../src/Smartable/Smartable";
import {createColumn, createColumns} from "../src/Smartable/Column";
// Create main table.
const Smartable = createSmartable({
columns: createColumns(
createColumn("123", {
title: "test",
}),
createColumn("456", {
title: "ttt",
}),
createColumn("789", {
title: "another",
}),
createColumn("test", {
title: "last one",
}),
),
});
export function DemoTable()
{
return (
<Smartable.Table shownColumns={["123", "456", "test"]} data={[
{
"123": {
data: "test abc",
},
test: {
data: 123,
},
"789": {
data: "test etset",
},
"456": {
data: "test vccvcvc",
},
},
{
"123": {
data: "any data",
},
test: {
data: 5552,
},
"789": {
data: "foo bar",
},
"456": {
data: "baz",
},
},
{
"123": {
data: "test test",
},
test: {
data: 5552,
},
"789": {
data: "other test",
},
"456": {
data: "infinite testing",
},
},
]} />
);
}