Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1685
How to keep same place active after pinning rows?
posted

I want to be able to pin rows, but leave the current active position in the same place ready for the next row to pin.

By default the pinned row stays active and so down arrow will start you at the top again, which can be annoying if the rows your looking at are a screen or more down.

Is there a recommended approach to this?

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

    I'm not sure I am following you. I tried this out and if I click on the pin button in the row selector for a row, the row is not made active. I can see if the row is already active when I pin it that the row is still the ActiveRow after it's pinned and then that row is pinned (fixed) at the top of my grid.

    No scrolling takes place at this point and I can click on another row to fix that row, too.

    It sounds to me like maybe you have implemented a way for your users to fix a row via a keyboard shortcut and that after they fix a row, you want them to be able to arrow down to what would have been the next row after the fixed row. Is that right?

    There's no built-in way to do this. But you could work around it in a couple of different ways. One way would be to fix up the ActiveRow after the current active row is fixed. So you could trap the BeforeRowFixedStateChanged event and get the fixed row and if it's the active row, you could get the next or previous row and store that in a variable. Then you could set the ActiveRow in the grid to that row in AfterRowFixedStateChanged.

    This seems a little weird to me, though, since the user might except the ActiveRow to be the one he just fixed.

    So the other approach would be to try to handle the grid's keyboard behavior when moving down from the last fixed row into a non-fixed row. You would want the focus to move onto the first visible row instead of the first actual row (which is scrolled out of view).

    The user would still have to arrow down, but not as far, and it probably wouldn't involved scrolling the grid to get the next row into view.

    Is that what you want? If so, then this could probably be done using the BeforePerformAction event. You would have to trap for the action that occurs when you press the down arrow key. But what this action is depends on what state the grid was in before you pinned the row and there's no enough information here for me to gather what that will be. It might be BelowRow or maybe BelowCell.

    You would have to try to detect this case where the focus is in the last fixed row and about to move to the first grid row and then cancel the event and handle setting the ActiveRow and/or ActiveCell yourself.

     

Reply Children
No Data