Search code examples
.netinfragistics

How to set by default scroll for WebDataGrid at the bottom of the grid


Currently , we set the scrolltop as follows:

   webGrid.ScrollTop = dt.Rows.Count * 30;

where dt contains the total data for binding into the webgrid. But when huge data is present in datatable and after setting scrolltop property, the webGrid.Rows.Count is reducing which is causing issue. Kindly help to set scroll bottom for webgrid without reducing the webGrid rows count


Solution

  • You mentioned rows count reducing, does this means that you are using Virtual Scrolling, and not all rows are loaded initially?

    As for you question there is easy way to implement this on the client. You can get the scroll container height - $("#WebDataGrid1 table[role='grid']") .. and use scrollTop in order to scroll to the bottom of the container.

    var height = parseInt($("#WebDataGrid1 table[role='grid']").css("height"));
    ig_controls.WebDataGrid1._container.scrollTop = height;