General Category > Suggest new features

Option to allow horizontal scroll bar when needed when scrollModel.autofit=true

(1/1)

jplevene:

--- Code: ---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%",
   ...
}
--- End code ---

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 or the ones past that.

Request an option as another value in scrollModel.autoFitScrollbar=true or something that ONLY displays the horizontal scroll bar when it is needed due to column minWidth values oversizing.  If the grid is wide enough to contain all minWidth values, then there is no scroll bar and it acts like before.

I feel this needs to be an option and not a default behaviour due to backwards compatibility.

This is also very important for adaptive pages, as when switching to vertical mobile, this would be necessary.  This feature would make pqGrid more adaptive compatible.

joshua519:
Hello everyone,

I?m new to the forum and exploring ParamQuery Grid for a responsive project. I found this thread really insightful, but I?m curious about one aspect.

If we enable a feature like
--- Code: ---scrollModel.autoFitScrollbar=true
--- End code ---
as suggested, would the horizontal scrollbar appear dynamically only when necessary, or would it remain visible at all times even when the grid width matches the minWidth values of the columns?

Also, are there any known workarounds or examples for implementing something similar in the current version while waiting for this feature to be considered?

Thanks in advance for your guidance!

jplevene:
I have added this with a resize observer, but it would be better to have this as a feature:


--- Code: ---new ResizeObserver(function(){ setTimeout(function(){ grid_resize(); }, 100); }).observe( $("#grid")[0] );
...
function grid_resize()
{
if($("#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});
}
}
--- End code ---

paramvir:
This feature was available in older versions of pqgrid but lost when we migrated to smooth native scrolling in v5.

It has been reintroduced in upcoming version, thanks for your feedback.

Navigation

[0] Message Index

Go to full version