[CLOSED] Infinite scrolling and selection

  1. #1

    [CLOSED] Infinite scrolling and selection

    Hello.

    I faced with following issue. I select some records at the begining of the grid and scroll grid down and up. After that selection is reseted for records which were moved form view. To reproduce this. I created a smaple (see below). Try to click "Select" button and scroll the grid down and up.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = this.TestData(5000);
                this.Store1.DataBind();
            }
        }
    
        private object[] TestData(int count)
        {
            string[] firstNames = new string[] { "Ed", "Tommy", "Aaron", "Abe", "Jamie", "Adam", "Dave", "David", "Jay", "Nicolas", "Nige" };
            string[] lastNames = new string[] { "Spencer", "Maintz", "Conran", "Elias", "Avins", "Mishcon", "Kaneda", "Davis", "Robinson", "Ferrero", "White" };
            int[] ratings = new int[] { 1, 2, 3, 4, 5 };
            int[] salaries = new int[] { 100, 400, 900, 1500, 1000000 };
    
            object[] data = new object[count];
            Random rnd = new Random();
    
            for (int i = 0; i < count; i++)
            {
                int ratingId = rnd.Next(ratings.Length);
                int salaryId = rnd.Next(salaries.Length);
                int firstNameId = rnd.Next(firstNames.Length);
                int lastNameId = rnd.Next(lastNames.Length);
    
                int rating = ratings[ratingId];
                int salary = salaries[salaryId];
                string name = String.Format("{0} {1}", firstNames[firstNameId], lastNames[lastNameId]);
                string id = "rec-" + i;
    
                data[i] = new object[] { id, name, rating, salary };
            }
    
            return data;
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Buffered Scrolling - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var go = function () {
                var me = this,
                    field = me.up('toolbar').down('#gotoLine');
    
                if (field.isValid()) {
                    me.up('grid').verticalScroller.scrollTo(field.getValue() - 1, true);
                }
            };
    
            var selectFirst = function (grid, cnt) {
                var itemsToSelect = []
                for (var i = 0; i < cnt; i++) {
                    itemsToSelect.push({ recordID: 'rec-' + i });
                }
    
                var sm = grid.getSelectionModel();
                sm.selectedData = itemsToSelect;
                grid.initSelectionData();
            };
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <h1>Buffered Scrolling</h1>
    
            <p>Ext.Net 2's brand new grid supports infinite scrolling, which enables you to load any number of records into a grid without paging.</p>
    
            <p>The new grid uses a virtualized scrolling system to handle potentially infinite data sets without any impact on client side performance.</p>
    
            <p>This example illustrates loading of all the records up front and buffering the rendering.</p>
            
            <ext:GridPanel ID="GridPanel1" 
                runat="server" 
                Title="Bufffered Grid of 5,000 random records"             
                Width="700" 
                Height="500">
                <Store>
                    <ext:Store 
                        ID="Store1" 
                        runat="server" 
                        PageSize="5000" 
                        Buffered="true">                    
                        <Model>
                            <ext:Model ID="Model1" runat="server" IDProperty="entityId">
                                <Fields>
                                    <ext:ModelField Name="entityId" />
                                    <ext:ModelField Name="name" />
                                    <ext:ModelField Name="rating" Type="Int" />
                                    <ext:ModelField Name="salary" Type="Float" />
                                </Fields>
                            </ext:Model>
                        </Model>            
                    </ext:Store>
                </Store>            
                <View>
                    <ext:GridView ID="GridView1" runat="server" TrackOver="false" />
                </View>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" PruneRemoved="false" Mode="Multi" />
                </SelectionModel>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn ID="RowNumbererColumn1" 
                            runat="server" 
                            Width="40" 
                            Sortable="false" />
                        <ext:Column ID="Column1" 
                            runat="server" 
                            Text="Name" 
                            Flex="1" 
                            DataIndex="name" />
                        <ext:Column ID="Column2" 
                            runat="server" 
                            Text="Rating" 
                            Width="125" 
                            DataIndex="rating" />
                        <ext:Column ID="Column3" 
                            runat="server" 
                            Text="Salary" 
                            Width="125" 
                            DataIndex="salary" 
                            Align="Right">
                            <Renderer Format="UsMoney" />
                        </ext:Column>                    
                    </Columns>
                </ColumnModel>
                <BottomBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:NumberField ID="NumberField1" 
                                runat="server"
                                FieldLabel="Jump to row"
                                MinValue="1"
                                MaxValue="5000"
                                AllowDecimals="false"
                                ItemId="gotoLine"/>
    
                            <ext:Button ID="Button1" runat="server" Text="Go">
                                <Listeners>
                                    <Click Fn="go" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button runat="server" Text="Select">
                                <Listeners>
                                    <Click Handler="selectFirst(#{GridPanel1}, 1000);" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </BottomBar>       
            </ext:GridPanel>
        </form>
    </body>
    </html>
    Is there any way to solve this issue?

    Best ragards.
    Last edited by Daniil; Dec 17, 2012 at 11:27 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I am unable to reproduce. What is the Ext.NET sources you are testing with?
  3. #3
    I tested with assembly with version 2.1.0.25673
  4. #4
    Is it 2.1.0 release or some sources from SVN?
  5. #5
    It's from SVN revision 4370, built using Ext.Net.WebForm project (we don't need MVC).
  6. #6
    It looks to be an old revision.

    Do you have a chance to update?
  7. #7
    Updated to 4380 and it is no longer reproducible.
    Thank you.

Similar Threads

  1. [OPEN] [#38] Combobox with infinite scrolling
    By Leonid_Veriga in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 17, 2012, 12:38 AM
  2. [CLOSED] TreePanel infinite scrolling
    By Leonid_Veriga in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 06, 2012, 5:13 PM
  3. [CLOSED] Infinite Scrolling
    By rnachman in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 09, 2012, 5:03 PM
  4. [CLOSED] Infinite Scrolling with MVC
    By RCN in forum 2.x Legacy Premium Help
    Replies: 14
    Last Post: Apr 12, 2012, 6:27 PM
  5. [CLOSED] Infinite Scrolling
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 09, 2011, 6:15 PM

Posting Permissions