A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/sizing.html below:

Angular Grid Sizing - Ignite UI for Angular

Angular Grid Sizing

There are many different ways to size the IgxGrid in order to accommodate a lot of scenarios that the users can have. While some are straight forward, others might be more complex and that is why we will take each one and look into them in more depth. We will go through setting width and height separately since there are some differences e.g. when using percentages for each.

When it comes to border and padding size for the IgxGrid, they are taken into its width/height size calculations or also known as Border box sizing. It is applied in all scenarios.

Note

If the Border box sizing is overridden by the user we cannot guarantee that the IgxGrid will size correctly.

Width

If the width input does not have value assigned, its default value is 100% and the IgxGrid tries to fill the available space. You can check how the grid reacts to it in the Percentages section.

Note

Setting manually the width style of the IgxGrid itself will result in an unexpected behavior.

Null

The grid's width can accepts value of null, which when set, renders all columns in the DOM. The grid sizes accordingly so there is no grid horizontal scrollbar since column virtualization is not applied.

Note

Due to this behavior, if the grid data contains too many columns, it might have significant impact on the browser performance, since all columns would be rendered without virtualization.

Pixels

When the IgxGrid width input is set to pixels it will set the whole grid size to that value and it will be static. It will not react to any browser resizing or changes in the DOM, although this is not the case for the grid content:

Percentages

When the width of the IgxGrid is set to percentages it will size the grid according to the parent element's width. If the parent element does not have width specified the IgxGrid will size relative to the browser window.

Height

By default if no height is defined for the IgxGrid, it will be set to 100%. You can check how the grid reacts depending on the DOM structure in the Percentages section.

Note

Setting manually the height style of the IgxGrid itself will result in an unexpected behavior.

Null

The IgxGrid height input can accept null value, which when set, displays all rows with no scrollbar no matter how many they are. In this case, there is no vertical virtualization since the grid renders all rows anyway.

Note

Due to this behavior, if the grid data contains too many rows, it might have significant impact on the browser performance, since all rows would be rendered without virtualization.

Pixels

Setting the IgxGrid height in pixels is more straightforward since the grid will size to that specific size in all occasions similarly to how width is set in pixels.

Percentages

When the height input is set to percentages the IgxGrid will size based on the parent element height. If the parent element has its height set in pixels or percentages, the grid will size relative to the size of the parent.

When the parent element does not have defined height, the browser does not assign height to it initially and sizes it based on its children and their size. That is why there is no way for the grid to know what base height to use in order to apply percentage sizing based on it. For this reason, it will render a maximum of 10 rows and if they are more rows, a vertical scrollbar will be rendered. Otherwise, the grid will fit to number of rendered rows. We will look in this scenario in more detail in the next examples.

Let's have width set to 1200px and the parent element not having any size applied to it:

Column Sizing

Depending on the grid size itself, the columns inside it can also be sized differently that could result in scenarios where the grid renders horizontal scrollbar or not. Columns can have width set in pixels, percentages or autosized when nothing is set. We will take a deeper look regarding these scenarios in this section.

Default

By default when a column doesn't have a specified width it will try to autosize, so that it fills if any empty space is available in the grid view area. Autosized columns have minimum width of 136px, so if the area available is less than 136px for that column, it will default to that size.

When the grid is resized in these scenarios, the column width is also updated to reflect the changes, so it fills any new empty space available.

Note

Feature columns like Row Selector checkbox column and etc. fill additional space that is taken into account when autosizing columns.

Pixels

When columns have set specific width in pixels, they stick to that size, unless they are resized manually. Since the combined width of the columns is static, it can be less than the IgxGrid width or exceed it.

Auto

When columns are set to auto their size adjusts to fit the longest word in the column. Empty areas are possible if there are cells with very short values, while other cells have very long ones. In this scenario, all cells in the column would adjust to take the width of the cell with the longest value.

Percentages

When columns have set width in percentages, their size is calculated relatively to the grid size. It is similar to how width in pixels works, but provides also responsiveness to the columns which means that when the grid is resized, the columns also will resize accordingly.

API References Additional Resources Our community is active and always welcoming to new ideas.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4