Hi,I am trying to achieve row virtualization in igGrid. I want to auto scroll igGrid and select the row programmatically as per needs. Seems like the rowVirtualization only works if the width of the column is set in px or percentage and not asterisk (*).
Is there any way to scroll grid to the correct row on any page in the grid and keep the width as * so that the content can be shown properly?
Hello Dipesh,
The rowVirtualization feature in the Infragistics IgniteUI for jQuery igGrid indeed has limitations regarding column width when using the asterisk (*) configuration. However, you can work around this to achieve the desired functionality.
Instead of using the *, calculate the available width dynamically in JavaScript and set the column widths programmatically. This provides the illusion of proportional sizing while meeting the requirements of rowVirtualization. This code should be called on load and on resize.
function adjustColumnWidths() { var gridWidth = $("#grid").width(); var columns = $("#grid").igGrid("option", "columns"); var columnCount = columns.length; var columnWidth = Math.floor(gridWidth / columnCount); for (var i = 0; i < columns.length; i++) { columns[i].width = columnWidth + "px"; } $("#grid").igGrid("option", "columns", columns); $("#grid").igGrid("dataBind"); }
To scroll to specific row you can use the following code where the rowIndex represents the index of the row you would like to scroll to:
$("#grid").igGrid("scrollTo", rowIndex);
Please let me know if you need any further assistance
Regards, Ivan Kitanov