[FIXED] [#703] GridPanel scroll inconsistency

  1. #1

    [FIXED] [#703] GridPanel scroll inconsistency

    Hi,

    Update: I experienced the described problem under Windows 8 with IE 11. Have not tested other browsers yet.

    I have noticed some inconsistent behavior in GridPanel's scrollbar when changing pages. This might lead to some unexpected problems which I will describe later.

    How to reproduce:

    1. Run the code below
    2. Scroll down to the last row in the first page
    3. Click "Next" page.
    4. The scroll bar is set back to the first row of the second page <- This is behavior I would expect when going to every next page.
    5. Scroll down again to the last row in the second page
    6. Click "Next" page.
    7. Scroll is NOT GOING BACK to the first row of next page
    8. Click "Next" page.
    9. Scroll position remains at the end of the next page
    10. And so on.... to the last page where scroll position is adjusted base on number of rows in the last page.


    The example code:

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <script runat="server">
        private object[] TestData
        {
            get
            {
                List<object> results = new List<object>();
    
                for (int i = 0; i < 100; i++)
                {
                    results.AddRange(
                        new object[]
                        {
                            new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                            new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                            new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                            new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                            new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
                            new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
                            new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" }                            
                        });
                }
    
                return results.ToArray();
            }
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = this.TestData;
            }
        }
    
    
        protected void Store1_Refresh(object sender, StoreReadDataEventArgs e)
        {
            this.Store1.DataSource = this.TestData;
            this.Store1.DataBind();
        }
    </script>
    
    <html>
    <head runat="server">
        <title>Scroll positioning issue</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
            <ext:Store
                ID="Store1"
                runat="server"
                OnReadData="Store1_Refresh"
                PageSize="100">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="company" />
                            <ext:ModelField Name="price" Type="Float" />
                            <ext:ModelField Name="change" Type="Float" />
                            <ext:ModelField Name="pctChange" Type="Float" />
                            <ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            <ext:GridPanel
                ID="GridPanel1"
                runat="server"
                StoreID="Store1"
                Title="Array Grid"
                Width="600"
                Frame="true"
                Height="300">
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
                        <ext:Column runat="server" Text="Price" Width="75" DataIndex="price" />
                        <ext:Column runat="server" Text="Change" Width="75" DataIndex="change" />
                        <ext:Column runat="server" Text="Change" Width="75" DataIndex="pctChange" />
                        <ext:DateColumn runat="server" Text="Last Updated" Width="85" DataIndex="lastChange" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:CheckboxSelectionModel runat="server" Mode="Multi">
                    </ext:CheckboxSelectionModel>
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolbar runat="server" StoreID="Store1" DisplayInfo="true">
                        <Plugins>
                            <ext:SlidingPager runat="server" />
                        </Plugins>
                    </ext:PagingToolbar>
                </BottomBar>
            </ext:GridPanel>
        </form>
    </body>
    </html>


    Questions:

    1. Is there any setting that let the scroll remain in the same position ?
    2. How can we make scroll going back to the first row ?


    Unexpected problem(s):

    I could not reproduce the unexpected problem in example code above.

    From time to time I ended up with exception in Ext.view.NodeCache in function "scroll". That function is ending with:

    return newNodes.childrenArray
    I had a case in my own application, where I reproduced steps mentioned above I got exception in scroll method. The "newNodes" were undefined.
    The outcome of that was a big gap in the beginning of my gridpanel:




    I added "quick fix" to the end of the "scroll" function:

    if (newNodes) {
        return newNodes.childrenArray
    }
    else {
        return null;
    }

    but it is not the best solution (and there are cases I don't get exception and still end up with the gap)


    Thank you
    Attached Thumbnails Click image for larger version. 

Name:	scrolling problem.png 
Views:	10 
Size:	65.4 KB 
ID:	20481  
    Last edited by fabricio.murta; Apr 27, 2016 at 2:27 AM.
  2. #2

    web browsers

    The problem can be reproduced in

    - IE 11.0.9600.17498
    - Chrome Version 40.0.2214.94 m
    - Opera 27.0.1689.66

    There is no inconsistency (the scroll remains at the bottom all the time) in

    - FireFox 35.0.1
    - Safari 5.1.7

    All the browsers were tested under Window 8.
    Last edited by matt; Feb 05, 2015 at 2:06 PM.
  3. #3
    Hi matt,

    Just for completeness and to help narrow down the problem I've tested with both the nuget package and the latest svn under Windows 7 with IE 11.0.9600.17501, FF 35.0.1 and Chrome (same version as yours).

    The problem exists only when the latest svn is used. It is reproducible in all three browsers (including FF 35.0.1...).

    When using the nuget package there is no problem at all.

    Can you please tell me what ext.net version are you using?
    Last edited by Dimitris; Feb 05, 2015 at 4:52 PM.
  4. #4
    Hi,

    At the moment the Ext.Net version is 3.1.0.25714. (SVN 6314)

    Thank you,
  5. #5
    It looks like the grid maintains the scrollbar position on purpose, though. In fact, it maintains the exact position not just the top or the bottom. In IE and Chrome this happens to all pages except for the second one (inconsistent). In FF it works fine.

    Do you prefer the grid to focus on the first row of each page?
  6. #6
    Hi,

    I don't mind either of the solutions (stay or go back) as long I will not see "the gap" presented in the picture in my first post. I am pretty sure it would be relatively easy to add a (few) line(s) of code to make sure that scroll bar is back to the beginning after every load. That should solve my "gap" problem but I don't want to do it this way.

    What I need to do is try to reproduce the "gap" problem on very simple example. I have noticed that I can reproduce it in my application only on certain resolution (height). For example ... on my laptop using IE I get reproduce the gap every time. On my desktop where resolution is much higher I can't.

    It must have something to do with number of visible rows at the time where some calculation is going wrong.

    The annoying part is that I did not get any unhanded exception where I could trace the problem (except the one in scroll function ... but that's a start).

    I thought, someone has already seen similar problem... unfortunately this one is not going to be an easy one to solve.

    I will try my best to reproduce the gap issue on plain/simple example and then hopefully someone can help me with that.
    At the moment it is not end of the world as it happens rarely. Having said that, tonight when I was testing my app on iPad, the same thing (gap) happened again :(
  7. #7
    Hello everybody,

    Or, it looks we are dealing with two different issues (mostly) in this thread.

    1. Scroll position resets on first page change, but it doesn't on subsequent changes.

    I found this bug report on the Sencha forums - Paginate grid doesn't scroll top when we load page.

    I am pretty sure we are talking about the same issue.

    To be brief, the expected behavior is to reset the scroll position on each page change. It works with ExtJS 5.0 and Ext.NET 3.0, but it has stopped working in ExtJS 5.1 and Ext.NET 3.1. If Sencha has opened a bug for that, I tend to create an Issue to track it:
    https://github.com/extnet/Ext.NET/issues/703

    As a workaround I can suggest to try this for the GridPanel.
    <Listeners>
        <ViewReady Handler="this.getStore().on('load', function() { this.getView().getEl().scrollTo('top', 0); }, this);" />
    </Listeners>
    Also some information to be aware of. I think there is some scroll maintaining functionality in Firefox. Please try to move the scroll and refresh the page (F5). The scroll bar stays on its position. It doesn't happen in IE or Chrome, the scroll bar position resets. So, it might be a reason (one of all, at least) why it might behave in a different way in Firefox.

    2. The "gap" problem.

    I am pretty sure it is a different issue. We would really prefer to keep one issue per thread. Especially, if a thread is already associated to a GitHub issue. Please feel free to post cross-references between the two threads if you want.
  8. #8
    Hello!

    ExtJS claims they fixed this issue, so it should not longer be actual in Ext.NET for some time already!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 8
    Last Post: Jun 06, 2013, 12:42 PM
  2. [CLOSED] ComponentLoader inconsistency
    By RCN in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 07, 2012, 12:24 PM
  3. GridPanel scroll can't use
    By qch2006qch in forum 1.x Help
    Replies: 0
    Last Post: Feb 10, 2012, 10:47 AM
  4. Replies: 1
    Last Post: Jan 13, 2011, 11:23 AM
  5. [CLOSED] Window Borders inconsistency
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 27, 2009, 4:46 AM

Tags for this Thread

Posting Permissions