You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use the `expand` slot to display extra information about a row. You will have access to the `row` property in the slot scope.
318
+
You can use the `v-model:expand` to enables row expansion functionality in the table component. It maintains an object containing an `openedRows` an array and `row` an object, which tracks the indices of currently expanded rows.
319
+
320
+
When using the expand slot, you have access to the `row` property in the slot scope, which contains the data of the row that triggered the expand/collapse action. This allows you to customize the expanded content based on the row's data.
319
321
320
322
::component-example{class="grid"}
321
323
---
@@ -327,6 +329,73 @@ componentProps:
327
329
---
328
330
::
329
331
332
+
#### Event expand
333
+
334
+
The `@update:expand` event is emitted when a row is expanded. This event provides the current state of expanded rows and the data of the row that triggered the event.
335
+
336
+
To use the `@update:expand` event, add it to your `UTable` component. The event handler will receive an object with the following properties:
337
+
-`openedRows`: An array of indices of the currently expanded rows.
338
+
-`row`: The row data that triggered the expand/collapse action.
Controls whether multiple rows can be expanded simultaneously in the table.
368
+
369
+
```vue
370
+
<template>
371
+
<!-- Allow only one row to be expanded at a time -->
372
+
<UTable :multiple-expand="false" />
373
+
374
+
<!-- Default behavior: Allow multiple rows to be expanded simultaneously -->
375
+
<UTable :multiple-expand="true" />
376
+
377
+
<!-- Or simply -->
378
+
<UTable />
379
+
</template>
380
+
381
+
```
382
+
383
+
#### Disable Row Expansion
384
+
385
+
You can disable the expansion functionality for specific rows in the UTable component by adding the `disabledExpand` property to your row data.
386
+
387
+
> Important: When using `disabledExpand`, you must define the `columns` prop for the UTable component. Otherwise, the table will render all properties as columns, including the `disabledExpand` property.
388
+
389
+
::component-example{class="grid"}
390
+
---
391
+
extraClass: 'overflow-hidden'
392
+
padding: false
393
+
component: 'table-example-disabled-expandable'
394
+
componentProps:
395
+
class: 'flex-1'
396
+
---
397
+
::
398
+
330
399
### Loading
331
400
332
401
Use the `loading` prop to indicate that data is currently loading with an indeterminate [Progress](/components/progress#indeterminate) bar.
@@ -449,6 +518,43 @@ componentProps:
449
518
---
450
519
::
451
520
521
+
### `expand-action`
522
+
523
+
The `#expand-action` slot allows you to customize the expansion control interface for expandable table rows. This feature provides a flexible way to implement custom expand/collapse functionality while maintaining access to essential row data and state.
0 commit comments