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

DataTable: column resize does not work anymore #6436

Closed
ray007 opened this issue Sep 19, 2024 · 3 comments
Closed

DataTable: column resize does not work anymore #6436

ray007 opened this issue Sep 19, 2024 · 3 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ray007
Copy link

ray007 commented Sep 19, 2024

Describe the bug

Resizing a column with mouse does not work anymore since upgrading to the latest version 4.0.7.
Reproducer link is just a non-modified fork of the column resize demo from the docs.

AFAICT the attribute selector for the table in the created stylesheet is wrong.

Reproducer

https://stackblitz.com/edit/ryzkcf?file=src%2FApp.vue

PrimeVue version

4.0.7

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Try to resize column with mouse, resize element is shown in wanted position, but on resize end the columns stay the same.

Expected behavior

Resize changes column size.

@ray007 ray007 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 19, 2024
@titus-weller-taxact
Copy link

This seems to be related to Vue version 3.5.6. PrimeVue column resize works with Vue version 3.5.5 and PrimeVue version 4.0.7.

@ray007
Copy link
Author

ray007 commented Sep 24, 2024

Hmm, very strange.
Has this already been reported to the vue project?
If not, any idea how to best report this? I have no idea what's the problem here...

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 25, 2024
@tugcekucukoglu tugcekucukoglu self-assigned this Sep 25, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.1.0 milestone Sep 25, 2024
tugcekucukoglu added a commit that referenced this issue Sep 25, 2024
@egorvinogradov
Copy link

egorvinogradov commented Oct 6, 2024

Changing versions of Vue, Nuxt, primevue didn't help. I was only able to fix this by applying a dirty fix on columnResizeEnd

Vue HTML:

<DataTable
  ref="table"
  @columnResizeEnd="applyDirtyColumnResizeFix"
  ...>
</DataTable>

JS in the Vue component:

applyDirtyColumnResizeFix(){
  const pvIdAttribute = Array.from(this.$refs.table.rootEl.attributes).find(attr => attr.name.startsWith('pv_id_'))?.name;
  const columnSizesStyle = Array.from(document.querySelectorAll('style')).find(style => style.textContent.includes('data-pc-name="datatable"'));
  if (columnSizesStyle) {
    columnSizesStyle.textContent = columnSizesStyle.textContent.replace(/\[pv_id_[0-9]+\]/igm, `[${pvIdAttribute}]`);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants