Skip to main content

Adding rows

To add rows to the table, use the data property.

You should add a new object to the data array with values for each row. Each parameter is the column ID from the columns property.

<script>
import { Grid } from "@wx/svelte-grid";
import { getData } from "./common/data";

const { columns } = getData();

const data = [
{
id: 1,
city: "Amieshire",
country: 6,
email: "Leora13@yahoo.com",
firstName: "Ernest",
lastName: "Schuppe",
street: "Ratke Port",
zipCode: "17026-3154",
date: new Date("2016-09-23T07:57:40.195Z"),
companyName: "Lebsack - Nicolas",
stars: 820,
followers: 70,
newsletter: true,
checked: 1,
},
];
</script>

<div style="padding: 20px;">
<div>
<Grid {data} {columns} />
</div>
</div>