Author Topic: Automatic column width  (Read 11302 times)

webifi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 45
    • View Profile
Automatic column width
« on: November 29, 2014, 10:29:53 pm »
Is there an automatic column width option?

It seems I can only set it by percentage, px, and then a min or max.   The last column, if no max is set, seems to expand to fill any remaining space.  Is there any way to allow columns other than the last column to fill any remaining width?

The problem comes in when I want to have one or more columns with a static width, and then the rest with percentage.  If the window is re-sized slightly, or you're off a little on the percentages, you end up scrolling.  I'm hoping there's an easy way to have empty space distributed evenly over  % sized columns that have not reached max width, or removed from % sized columns that have not yet hit minimum width.  As it is now, it seems that only the last column does this, and that's less than desirable in many use cases.
« Last Edit: November 29, 2014, 11:57:49 pm by webifi »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Automatic column width
« Reply #1 on: November 30, 2014, 12:22:04 am »
use scrollModel: { autoFit: true }

http://paramquery.com/pro/api#option-scrollModel

webifi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Automatic column width
« Reply #2 on: November 30, 2014, 01:06:23 am »
That seems to only expand the last column.

Nevermind:  With autoFit, it looks like I need to set "maxWidth" on the ones I don't want to expand, and NOT use percentages on the ones I do want to expand to fill.
« Last Edit: November 30, 2014, 01:59:41 am by webifi »

webifi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Automatic column width
« Reply #3 on: December 06, 2014, 08:59:09 pm »
I still seem to be having some issues with  autoFit, this time related to scroll bars.

I use a grid in a .dialog, with grid using width:"auto", height:"100%-4", scrollModel:{autoFit:true}

The problem comes when using detailModels on a grid that doesn't yet have enough data to scroll.  When the detail shows, and then adds enough content to where vertical scrolling should happen in the parent grid, the scrollbar doesn't show properly unless I re-size the dialog.  There also seems to be some scrollbar/width inconsistencies when using filtering.

As a temporary work-around, I've added the css: .pq-grid .pq-vscroll {display:block !important;}.  This forces the vertical scrollbar to show all the time, but the scrolling handle still doesn't appear when an expanding detail crosses the non-scrollable to scrollable height threshold.

Is there a setting that makes this all work more smoothly?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Automatic column width
« Reply #4 on: December 08, 2014, 04:34:59 pm »
There is a known issue in scrollModel autoFit when there is variable content/height of rows. It would possibly be resolved in the next version.

webifi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Automatic column width
« Reply #5 on: December 08, 2014, 09:18:57 pm »
There is a known issue in scrollModel autoFit when there is variable content/height of rows. It would possibly be resolved in the next version.

Thanks.  I look forward to the fix.
For now I'm using this css as a work-around:
Code: [Select]
.pq-grid .pq-vscroll, .pq-grid .pq-vscroll .pq-sb-slider {
    display:block !important;
}

Not perfect, but it makes the grids usable during our evaluation.