Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Table): emit expand event #2063

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

feat(Table): emit expand event #2063

wants to merge 2 commits into from

Conversation

s1gr1d
Copy link

@s1gr1d s1gr1d commented Aug 20, 2024

πŸ”— Linked issue

Resolves #2062

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Emitting an event when a row is expanded. Useful for e.g. fetching data before the row is expanded.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

if (openedRows.value.includes(index)) {
openedRows.value = openedRows.value.filter((i) => i !== index)
} else {
openedRows.value.push(index)
emit('update:expand', { expandedRows: openedRows.value, row })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be emitted in both case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it? I think it could be either emitted in both cases and the information whether it was an "expand" or "collapse" could be added as a function parameter to the user or there could be another emit like update:collapse. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you send the openedRows in the event, we should emit each time the openedRows.value changes I guess.

@benjamincanac benjamincanac changed the title feat(table): Emit expand event feat(Table): emit expand event Aug 22, 2024
@@ -314,6 +314,29 @@ componentProps:
---
::

#### Custom `expand` event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Custom `expand` event
#### Reactive expand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing additional logic to the expand function
2 participants