Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / horizontal scroll in iggrid

horizontal scroll in iggrid

New Discussion
Ravi Bhatta
Ravi Bhatta asked on Nov 19, 2019 2:08 PM

Hello,

We are using igGrid like a core component and using it in several other components. In our component we have an option to show/hide colum by using “columchooser” option.We are facing an issue with width of colum and horizontal scrollbar

if we set Grid width to “100%”  & “defaultColumnWidth” for example to “140px” and initially we have only 3 colums then table colums getting shrinked(not occupying entire grid width) or last colum occupying entire remaining width. Can refer below screenshots.

gridOptions = {

autoGenerateColumns: false,
defaultColumnWidth: ‘140px’, or ‘ * ‘
width: ‘100%’,

}

if we give “defaultColumnWidth” in pixels then if we choose more colums from “columchooser” horizontal scrollbar disappears. Can see in below screenshot.

gridOptions = {

autoGenerateColumns: false,
defaultColumnWidth: ‘40%’,
width: ‘100%’,

}

How to adjust width initially and with colum chooser with horizontal scrollbar?

Sign In to post a reply

Replies

  • 0
    Vasya Kacheshmarova
    Vasya Kacheshmarova answered on Nov 19, 2019 2:08 PM

    Hello Ravi,

    Thank you for posting in our community.

    igGrid provides autofitLastColumn option. If set to true (as it is by default) and all column widths are specified (as it is when the defaultColumnWidth is set) and their combined width is less than the grid width then the last column width will be automatically adjusted to fill the remaining empty space of the grid.

    This means that for your first scenario, if you have 3 column with defaultColumnWidth set to "140px" and grid width set to "100%" and the total grid width is more that 3*140 = 420 px the last column width will be expanded so that it fulfils the empty space.

    In case that the default width is set to  "*" , which means that columns will be auto-sized based on the content of the column cells(including header) the grid will also auto-fit the last column.
    What I believe might work for your scenario is omit setting grid`s width and column width. In this case the grid will calculate these automatically.

    Attached you will find a small sample. It has 5 column, initially 3 are visible. Initially the grid width is equally divided between the tree columns, once an additional column is displayed the grid is recalculating the column widths.
    Please test this sample on your side and let me know if you have any additional questions regarding this matter.

    1385.igGridHScroll.zip

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Ravi Bhatta
Favorites
0
Replies
1
Created On
Nov 19, 2019
Last Post
6 years, 3 months ago

Suggested Discussions

Tags

No tags

Created by

Created on

Nov 19, 2019 2:08 PM

Last activity on

Feb 25, 2026 9:06 AM