quasar icon indicating copy to clipboard operation
quasar copied to clipboard

Q-Table support to columns drag resizing

Open dariodepaolis opened this issue 5 years ago • 33 comments

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like I'd like to have a prop to enable the manual resize of column by user. (Like Grid component in ExtJS or Syncfusion) Also a dblclick on the resizer the will expand to maximum width of the col will be awesome.

Describe alternatives you've considered No alternative so far found, we have to manually rewrite the table header adding dragging function, auto-width, expand, ellipsis etc.

dariodepaolis avatar Sep 20 '19 06:09 dariodepaolis

+1. If Quasar is going to get serious about an improved data table (which I would love) I think perhaps we should have a holistic discussion. Potentially huge amounts of work.

rfox12 avatar Oct 11 '19 17:10 rfox12

Hello,

You could check my pull request https://github.com/quasarframework/quasar/pull/5460

antonispat10 avatar Nov 04 '19 19:11 antonispat10

Great ty, asap I'll give it a try!

dariodepaolis avatar Nov 05 '19 08:11 dariodepaolis

This is more important now. User's expect columns to be able to be resized! Also need a nice / easy solution for truncating text. Some other thoughts...

  • set a minimum column size (entire table or per column). We don't want the user to make the column completely disappear unintentionally.

  • Have treatment options for text that is too long to fit in the cell (wrap text, use ellipses, or some "other" slot) AND be able to have variables that we can use to provide other UI actions (e.g. maybe I want to display a tooltip--but only if the text in that particular cell had to be truncated)

  • Sticky header and footer options without complicated CSS--to stay in effect if the QTable goes "fullscreen". I think having some caveats about browser support in the documentation would be ok...

  • Stretch goal... drag / reorder columns / rows

rfox12 avatar Jan 03 '20 19:01 rfox12

We would also love this feature 👍

satyavh avatar Jun 04 '20 11:06 satyavh

I had same problem, now I use https://quasar.dev/vue-components/splitter instead of tables.

bytebrain avatar Aug 29 '20 11:08 bytebrain

I would like to ask about the status of this feature. Is there any progress?

Jokertwo avatar Oct 16 '20 14:10 Jokertwo

I would like to ask about the status of this feature. Is there any progress?

Or exist there some workaround on how to solve it?

Jokertwo avatar Oct 19 '20 07:10 Jokertwo

Any update/solution on the issues? How can we raise the priority of this?

giftofsky avatar Nov 25 '20 06:11 giftofsky

I found one possible workaround for how to solve this issue. Example

Jokertwo avatar Nov 25 '20 09:11 Jokertwo

It's a "work-in-progress" as a directive that will work on any table (QTable, QMarkupTable, etc) but here is a starting point. There are issues with context for this directive. The data should be attached to the element itself and retrieved from there. Right now, you could only have one directive going. Also, the created divs should be maintained, so they can be deleted if necessary. Consider it a WIP. https://codepen.io/Hawkeye64/pen/dypyNWL

hawkeye64 avatar Nov 27 '20 19:11 hawkeye64

Many thanks @Jokertwo @hawkeye64. Tentatively, we'll try this while waiting Q-Table to fully support it ;)

giftofsky avatar Nov 28 '20 06:11 giftofsky

I will work on my this coming week and see if I can't clean it up a bit. Consider it pre-alpha and should not be usedfor anything yet, other than testing purposes

hawkeye64 avatar Nov 28 '20 12:11 hawkeye64

Cross ref:

  • https://github.com/quasarframework/quasar/issues/5115
  • https://github.com/quasarframework/quasar/issues/4138

pdanpdan avatar Feb 16 '21 14:02 pdanpdan

You know what, I had forgotten all about this. :( Such is a busy life

hawkeye64 avatar Feb 16 '21 17:02 hawkeye64

Any updates on that? Or maybe there any any 3rd party modules to drag resizing (and, by any change, drag column reordering)?

mikebrsv avatar Jun 18 '21 14:06 mikebrsv

Hey guys! Is there any plans for this, or there is no point to wait? No pressure, just wanna know :)

henryfool91 avatar Apr 23 '22 14:04 henryfool91

We're going to be starting a roadmap for Quasar v3. I will push to get this in, but no promises.

hawkeye64 avatar Apr 28 '22 20:04 hawkeye64

Is there any update on this. I thought I could hack up a work around to this real easy, but since the sorting icon is adding at the end (or beginning (yuck)) of the header, the resize icon is inside the sorting icon. No way around this without templating the entire header. So, it would be great to have this in 2.x, unless we are close to v3. I really don't want to have to go back to ag-grid. :-)

goldenram avatar Nov 22 '22 18:11 goldenram

Or if there is way to keep the sorting icon always on the left side instead of it moving around based on how the text is aligning, then it would be easier to template this. But cannot figure out a way to do that either.

goldenram avatar Nov 22 '22 18:11 goldenram

Here is a workaround for the sorting triggered by column resizing, based on hawkeye64's solution in https://codepen.io/Hawkeye64/pen/dypyNWL

In Class ResizableTable, set an indicator in the table for column resizing

onMouseDown(e) {
   ...
   this.table.colResizing = true;
}

In q-table, add a custom sort method :sort-method="customSort". In "customSort" function, check the indicator. If true, ignore the sorting and clear the indicator.

const table = document.getElementById([your table id]).__tableResizable.table;
if (table.colResizing) {
    table.colResizing = false;
    // return rows unsorted
} else {
    // sort as usual
}

wz5899 avatar Jan 27 '23 16:01 wz5899

Is this still being investigated? We have an active request on our implementation for this.

kiranfenrir avatar Jan 31 '23 18:01 kiranfenrir

Is it still WIP?

0xhellord avatar Apr 05 '23 12:04 0xhellord

Hello, please tell me, when the table appears horizontal scroll bar, this column dragging function is disabled, how should I solve it?

hope-zjl avatar Jul 04 '23 07:07 hope-zjl

I know this problem is not solved yet, but maybe someone wants to share their working solution? The problem with @hawkeye64 and @Jokertwo solution is that with a large volume of table columns, they simply stop working. I want to make an implementation that will extend beyond the table in width and include overflows.

Maybe someone implemented this?

neluckoff avatar Jul 24 '23 13:07 neluckoff

Would love to see this get implemented. I think this deserves to be moved up in priority and I think lots of users kind of expect this convenience from a UI/UX perspective. For example, we have a lot of active discussions and an issue opened for this exact request.

agroebe avatar Aug 02 '23 21:08 agroebe

+1 - we have clients asking for this now.

Daemach avatar Nov 30 '23 17:11 Daemach

yep, agree, basic feature which is missing.

aleksmelnyk avatar Dec 12 '23 15:12 aleksmelnyk

Here is a workaround for the sorting triggered by column resizing, based on hawkeye64's solution in https://codepen.io/Hawkeye64/pen/dypyNWL

In Class ResizableTable, set an indicator in the table for column resizing

onMouseDown(e) {
   ...
   this.table.colResizing = true;
}

In q-table, add a custom sort method :sort-method="customSort". In "customSort" function, check the indicator. If true, ignore the sorting and clear the indicator.

const table = document.getElementById([your table id]).__tableResizable.table;
if (table.colResizing) {
    table.colResizing = false;
    // return rows unsorted
} else {
    // sort as usual
}

@wz5899 thanks! However, when using your solution, the sorting icon will be changed. Actually we need to prevent sorting at all: add the no-pointer-events class to the table inside the onMouseDown event. Then remove the no-pointer-events class in the onMouseUp event:

onMouseDown(e) {
   ...
   this.table.classList.add('no-pointer-events');
}

onMouseUp(e) {
   ...
   this.table.classList.remove('no-pointer-events');
}

kirillidze avatar May 13 '24 14:05 kirillidze

5 years later and still no update on this?

gaby avatar Jul 24 '24 10:07 gaby