primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.08k stars 1.2k forks source link

DataTable: Custom component not rendering #5516

Closed nicolasr2310 closed 1 day ago

nicolasr2310 commented 6 months ago

Describe the bug

Wrapping the DataTable component like described on the documentation : https://tailwind.primevue.org/guides/building-ui-library/ doesn't work : the component doesn't render at all and no errors are shown.

Reproducer

https://codesandbox.io/p/devbox/agitated-danny-hjycnj

PrimeVue version

3.50.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

In the example as you can see the DataTable is shown if it comes directly from primevue library, but if it's the custom one wrapping it, it does not display the data even though the table tag is created.

Expected behavior

The component rendered correctly with the data inside

m-meier commented 6 months ago

The problem seems to be that the column definitions are not passed to the datatable and a table without columns isnt displayed.

Try adding a slot in your component: <DataTable v-bind="$attrs"><slot /></DataTable>

You can even automatically implement all available slots by using it like this: ` <template v-for="(_, slotName) in $slots" v-slot:[slotName]="slotProps"

`

tugcekucukoglu commented 1 day ago

Please track https://github.com/primefaces/primevue/issues/4940