29
src/components/DataTable.svelte
Normal file
29
src/components/DataTable.svelte
Normal file
@@ -0,0 +1,29 @@
|
||||
<script>
|
||||
import { Grid } from "gridjs";
|
||||
import "gridjs/dist/theme/mermaid.css";
|
||||
import { nanoid } from "nanoid";
|
||||
//
|
||||
const uniq = nanoid();
|
||||
const datatable = new Grid({
|
||||
columns: ["Name", "Email", "Phone Number"],
|
||||
sort: true,
|
||||
search: { enabled: true },
|
||||
data: [
|
||||
["John", "john@example.com", "(353) 01 222 3333"],
|
||||
["Mark", "mark@gmail.com", "(01) 22 888 4444"],
|
||||
["Eoin", "eoin@gmail.com", "0097 22 654 00033"],
|
||||
["Sarah", "sarahcdd@gmail.com", "+322 876 1233"],
|
||||
["Afshin", "afshin@mail.com", "(353) 22 87 8356"],
|
||||
],
|
||||
pagination: {
|
||||
enabled: true,
|
||||
limit: 2,
|
||||
summary: false,
|
||||
},
|
||||
});
|
||||
setTimeout(() => {
|
||||
datatable.render(document.getElementById("wrapper" + uniq));
|
||||
}, 0);
|
||||
</script>
|
||||
|
||||
<div id="wrapper{uniq}" />
|
||||
Reference in New Issue
Block a user