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): expand row #1036

Merged
merged 10 commits into from
Jul 23, 2024
Merged

feat(Table): expand row #1036

merged 10 commits into from
Jul 23, 2024

Conversation

EvertonWingert
Copy link
Contributor

@EvertonWingert EvertonWingert commented Nov 29, 2023

πŸ”— Linked issue

The linked issue is about nested tables, but I think this would also solve.

Resolves #746

❓ 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

This is my interpretation of #746

Implementation of a table that can be expanded.
Mainly used to show more details of a table row or related content.

Captura de tela 2023-11-28 214338

πŸ“ Checklist

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

Copy link

vercel bot commented Nov 29, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui βœ… Ready (Inspect) Visit Preview Jan 25, 2024 10:30am

@DarkGhostHunter
Copy link
Contributor

I second to this. I had to fallback to a Modal to show expanded info.

I also think I should be animated. Can Accordion be re-used?

Copy link
Contributor Author

@EvertonWingert EvertonWingert left a comment

Choose a reason for hiding this comment

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

I tried to implement it with animation, but I didn't get any good results

@richard-edwards
Copy link

Would love to see this soon :)

@shoaibsharif
Copy link

Any update on this?

@hoanghadu
Copy link

I would love to see this feature released

@zangetsu02
Copy link

any news about this?

@patrykskrzyniarz
Copy link

any progress?

{{ getRowData(row, column.key) }}
</slot>
</td>
</tr>

Choose a reason for hiding this comment

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

Suggested change
</tr>
</tr>
<slot :name="after-row" :row="row" :index="index" is-opened="openedRows.includes(index)" />

or so, to add some more flexibility
for example: dynamically loaded content that renders subsequent table rows while maintaining the width of the original table's columns

currently we have only 'expand' slot which is content of single cell with 100% table width + don't have access to style that tr + td element

@husayt
Copy link

husayt commented Jun 10, 2024

@benjamincanac would be great to have this merged. This feature is so missing in NuxtUi tables at the moment. PR has been here for some time. At least, feedback would be appreciated. Thank you

@benjamincanac
Copy link
Member

I'm so sorry for the delay! I've made a few changes to make the button configurable and to animate the icon 😊

@benjamincanac benjamincanac merged commit 7155318 into nuxt:dev Jul 23, 2024
2 checks passed
binhtranhuu pushed a commit to binhtranhuu/nuxt-ui that referenced this pull request Jul 28, 2024
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
@AnthonyCVP
Copy link

This is great! Thanks!

@rmbakker88
Copy link

rmbakker88 commented Aug 16, 2024

Great feature! However,

Not sure if I should post this here or as a separate bug, but if a table is set as expandable, and the table is empty at the same time, the emptyState will not take up the full width. See screenshot.

image

      <UTable
        :rows="selectedOrders"
        :columns="selectedOrdersColumns"
        class="w-full"
      >
        <template #id-data="{ row }">
          <span>{{ truncateUUID(row.id) }}</span>
        </template>
        <template #product-data="{ row }">
          <span>{{ row.product }}</span>
        </template>
        <template #expand="{ row }">
          <div class="p-4">
            <ul>
              <li>Bestelnummer: {{ row.id }}</li>
              <li>Aangemaakt op: {{ row.created_at }} door {{ row.created_by_full_name }}</li>
            </ul>
          </div>
        </template>
      </UTable>

simply removing the expand slot immediately solves it. any ui directives or making a custom empty state slot can not fix it.

@sandros94
Copy link
Collaborator

@rmbakker88 could I ask you to open up a new issue with a reproduction link?

@kpouters
Copy link

kpouters commented Sep 7, 2024

Expanding a row by clicking on it is currently not possible. That feature is definitely needed.
Please make the openedRows value accessible externally.

binhtranhuu pushed a commit to binhtranhuu/nuxt-ui that referenced this pull request Sep 14, 2024
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
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.

Nested data table(s)