Active row jumps to bottom

I have a grid with 100 rows and RowCount set to 100. All 100 rows show in the grid. A vertical scroll bar appears and I can scroll up and down through all 100 rows. So far this is just what I want.

I set ActiveRowColor to a colour of my choice and set MouseSelect to msMove. Now when I click on a row that row becomes selected. Also just what I want.

If I scroll down beyond the first page and then click on a row, that row becomes selected, BUT the grid immediately scrolls so that the newly selected row is at the bottom of the screen. That is not what I want. I want the newly selected row to stay in the same place it was in when I selected it.

How can I achieve this?

Thank you.


BTW this happens only in IE. In Firefox it behaves as I would expect.

Can you please try setting the Scroll.ScrollIntoView property to False?

Yes that solves the problem. Thanks for your help Bart.

Further to this I have the following observations (Scroll.ScrollIntoView set to true):

Clicking on a row
Firefox and Chrome highlight that row and it stays in position (as expected)
IE highlights that row but it jumps to the bottom (confusing for the user)

Inserting a row
I want the new row to be inserted at the end of the grid and that row to be made visible. I execute the following code:


  grd.TotalRows := grd.TotalRows + 1;
  grd.RowCount := grd.TotalRows;
  grd.ActiveRow := grd.TotalRows - 1;

Firefox and Chrome: row is inserted but grid does not scroll to end so it is not visible (confusing for the user).
IE: row is inserted and grid scrolls to end (desired behaviour).

Is there some way around these issues? I have tried turning ScrollIntoView off and the only difference is that IE no longer scrolls to the end of the grid when a row is inserted.

  • Clicking on a row:
    Unfortunately this is a specific browser behavior which we have no control over.
    I'll investigate if there is a possible workaround.

    - Inserting a row:
    I have not been able to reproduce this issue.
    IE, FIreFox and Chrome correctly scroll to the new row.

    Can you please let me know which version of Delphi, IntraWeb and browsers you are using so I can further investigate this?

OK, thanks. I can work around inserting by inserting the new row at the top rather than the bottom of the table as I can't easily reproduce the problem in a test app. I would appreciate it if you could find a workaround for IE scrolling so that the active row is always at the bottom.

On a different matter, is it possible to make the grid perform incremental search as the user types in it? So if I type 'M' it scrolls so that the first record starting with M in the sort column comes into view? I notice there is a ClientEvent called GridKeyDown but I don't know how to use this.


- The GridKeyDown ClientEvent is fired when a keydown event occurs on the IWAdvWebGrid. This requires that MouseSelect is set to msNone.

- Have you tried setting the Controller.ShowFind property to True? This will display a button in the grid's controller that starts a search action when clicked.