ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: jplevene on August 01, 2024, 08:31:27 pm

Title: Horizontal scroll bar scrollModel issue
Post by: jplevene on August 01, 2024, 08:31:27 pm
colModel: {
   ...
   colModel : [
      {dataIndx:"ID", minWidth:"60", maxWidth:80},
      {dataIndx:"TITLE", minWidth:"200"},
      {dataIndx:"ALT_TITLE", minWidth:"200"},
      {dataIndx:"LOCATION", minWidth:"200"},
      {dataIndx:"DESCRIPTION", minWidth:"200},
      {dataIndx:"PART_NUMBER", minWidth:"100"},
      {dataIndx:"LAST_UPDATE", minWidth:"100"}
   ],
   scrollModel:{autoFit:true},
   flex: {on:true, all:false, one:false},
   width: "100%",
   height: "100%",
   ...
}

The issue is that minWidth is set and when the table is lets say 500 wide, I can sometimes scroll to the column by clicking on it if it is partially shown, but I don't have a horizontal scroll bar to scroll to it.

The idea is that I fill the grid width as it resizes, but the minWidth can cause the internal width to be more than the table width and I need a horizontal scroll bar.  How do I do that or is it a feature request?
Title: Re: Horizontal scroll bar scrollModel issue
Post by: paramvir on August 02, 2024, 08:34:05 pm
That's not supported currently, can be added to feature request.
Title: Re: Horizontal scroll bar scrollModel issue
Post by: jplevene on February 11, 2025, 05:09:19 am
Just to help others, I accomplished this by doing the following:

Code: [Select]
new ResizeObserver(function(){ grid_resize(); }).observe( grid );

grid_resize()
{
if(grid && grid.is(":visible"))
{
// Do we add horizontal scroll
var width = 0;
grid.pqGrid("Columns").each(function(col){
if(!col.hidden)
width += intval(col["width"]);
});

// Do we hide or show the scroll bar
grid.pqGrid("option", "scrollModel", {autoFit:width<grid.width() ? true : false});
}
}