#Nuxt UI Table Expand - Programmatic/API Access

5 messages · Page 1 of 1 (latest)

pastel atlas
#

I'm using the table expandable feature - https://ui.nuxt.com/components/table#expandable

But I need a way to close this when something happens, i.e. the table results change, etc.. I'm not seeing a way to access this though, is it possible with the current implementation?

Nuxt UI

Display data in a table.

warm pollen
#

You could do something like this:

    ```<UTable :rows="people" ref="my-table">
        <template #expand="{ row }">
            <div class="p-4">
                <pre>{{ row }}</pre>
            </div>
        </template>
  </UTable>```

Script:

    const input = useTemplateRef("my-table");
    input.value?.toggleOpened(2);

I'm not sure if this is the intended way to use the toggleOpened(index) function though, I've just looked into the source code of the Table component and that's what I found.

pastel atlas
#

Either way - thank you so much for taking the time to dig into this.

#

Oh I overlooked where you called the index, my apologies