diff --git a/apps/www/src/content/docs/components/data-table.md b/apps/www/src/content/docs/components/data-table.md index 7d5330f7..b43074b4 100644 --- a/apps/www/src/content/docs/components/data-table.md +++ b/apps/www/src/content/docs/components/data-table.md @@ -889,6 +889,218 @@ You can show the number of selected rows using the `table.getFilteredSelectedRow + + +## Expanding + +Let's make rows expandable. + +### Update `` + +```vue:line-numbers {7,30,43,52,57,63,103-116} + + + +``` + +### Add the expand action to the `DataTableDropDown.vue` component + +```vue:line-numbers {12-14,34-36} + + + +``` + +### Make rows expandable + +Now we can update the action cell to add the expand control. + +```vue:line-numbers {11} + + +``` + + + ## Reusable Components Here are some components you can use to build your data tables. This is from the [Tasks](/examples/tasks) demo. diff --git a/apps/www/src/lib/registry/default/example/DataTableColumnPinningDemo.vue b/apps/www/src/lib/registry/default/example/DataTableColumnPinningDemo.vue index 16d27c9d..e6cb4617 100644 --- a/apps/www/src/lib/registry/default/example/DataTableColumnPinningDemo.vue +++ b/apps/www/src/lib/registry/default/example/DataTableColumnPinningDemo.vue @@ -1,6 +1,7 @@ @@ -201,15 +208,18 @@ const table = useVueTable({ diff --git a/apps/www/src/lib/registry/default/example/DataTableDemoColumn.vue b/apps/www/src/lib/registry/default/example/DataTableDemoColumn.vue index 1292cba3..93f7ba71 100644 --- a/apps/www/src/lib/registry/default/example/DataTableDemoColumn.vue +++ b/apps/www/src/lib/registry/default/example/DataTableDemoColumn.vue @@ -9,6 +9,10 @@ defineProps<{ } }>() +defineEmits<{ + (e: 'expand'): void +}>() + function copy(id: string) { navigator.clipboard.writeText(id) } @@ -27,6 +31,9 @@ function copy(id: string) { Copy payment ID + + Expand + View customer View payment details diff --git a/apps/www/src/lib/registry/new-york/example/DataTableColumnPinningDemo.vue b/apps/www/src/lib/registry/new-york/example/DataTableColumnPinningDemo.vue index 1f6f129d..7c3e0242 100644 --- a/apps/www/src/lib/registry/new-york/example/DataTableColumnPinningDemo.vue +++ b/apps/www/src/lib/registry/new-york/example/DataTableColumnPinningDemo.vue @@ -1,6 +1,7 @@ @@ -201,15 +208,18 @@ const table = useVueTable({ diff --git a/apps/www/src/lib/registry/new-york/example/DataTableDemoColumn.vue b/apps/www/src/lib/registry/new-york/example/DataTableDemoColumn.vue index 7031caa8..22c51491 100644 --- a/apps/www/src/lib/registry/new-york/example/DataTableDemoColumn.vue +++ b/apps/www/src/lib/registry/new-york/example/DataTableDemoColumn.vue @@ -9,6 +9,10 @@ defineProps<{ } }>() +defineEmits<{ + (e: 'expand'): void +}>() + function copy(id: string) { navigator.clipboard.writeText(id) } @@ -27,6 +31,9 @@ function copy(id: string) { Copy payment ID + + Expand + View customer View payment details