Ticket CQ19190
Visible to All Users

GridView - How to avoid auto focusing a partially visible row

created 18 years ago

My app is a slow 'scrolling' list of rows. New rows get added to the datasource periodically and I use AutoFocusNewRow to
automatically snap the added row into view when the row is added. I also let the user turn this off via a context menu,
but I notice the grid then automatically snaps to the _selected_ row, is there any way to turn this off? I really just want the
grid to keep its current scroll position when AutoFocusNewRow=false.
Thanks
Matt

Show previous comments (1)

    I'll try come up with a simple example…
    Perhaps I can explain better in the mean time. I have a grid, sorted by date, and I add rows to the bindinglist via code periodically. These rows appear (because of the sort) at the top of the grid. I want the new row to be automatically scrolled into view when it is added (AutoFocusNewRow=true seems to do this), and also want to give the user the chance to turn this off so his scroll position is maintained when a row is added. Though when I set AutoFocusNew row to false, the grid seems to auto scroll to the selected/focused row when a row is added, I cant seem to stop this from
    happening. I do _not_ add rows through the grid UI, it is all backend via the bindinglist…
    Thanks
    Matthew

    DevExpress Support Team 18 years ago

      Hi James,
      Sorry, we cannot reproduce this issue. I have prepared an example for you which works fine. It is attached. Please modify it to reproduce the issue and post here for analysis.
      Thanks,
      Michael.

        Michael, I've come up with an example to show the problem, and I think I've figured out why you're not seeing it…
        We're sorting a column so that new rows get added to the top.
        Run the attached sample and sort on one of the columns, so that new rows appear above (click the col header twice). I've created a column context menu called 'Snap To new Row' … The snapping to new row works perfectly, but when its off, try scroll anywhere, you will see the grid 'snap' back to the selected row, I dont want this, I want to keep my scroll position when a new row is added. Hope this finally shows the issue we are having.
        Please also take note of the version of VStudio and DevX we are using, your last example was compiled on VS2005 and
        we couldnt use it.
        Thanks
        Matthew

        Answers

        created 18 years ago

        Hi James,
        When the datasource is changed, row handles are regenerated and the grid tries to focus the previously focused row. When the row is focused the grid makes it visible. This behavior is by design.
        You can change it by creating a custom GridView in a GridControl descendant and overriding the GridView.MakeRowVisibleCore method and disabling its functionality.
        I have modified your project accordingly. It is attached.
        Please let us know if this makes sense.
        Thanks,
        Michael.

          Comments (2)

            Works perfectly thanks.

            DevExpress Support Team 18 years ago

              I am happy to hear that my assistance was helpful to you. Please do not hesitate to contact us if you experience problems when using our products.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.