Scrolling large grid with components

  1. #1

    Scrolling large grid with components

    Hello

    I apologize that this problem is hardly to reproduce. Basically the problem is that I have pretty large grid with component columns inside and when scroling quickly here and there, time to time, components does not render properly.
    After playing for a while I got it reproduced on sample below, but sometimes takes a minute or two of playing.
    Screenshots shows what I mean ( practically empty grid, while the scrollbar is not at the begining or at the end, or some components rendered and some not)

    So - to reproduce - click "simulate problem" button, and then play with scrollbar few times.
    Any advice?

    Code:

    <%@ Page Language="C#" %>
    
    
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Simple Array Grid With Paging and Remote Reloading - Ext.NET Examples</title>
    
        <script>
            var template = '<span style="color:{0};">{1}</span>';
    
    
            function simulateProblem() {
                var grid = Ext.getCmp('GridPanel1')
                var toAdd = [];
                grid.store.filterBy(function (item) {
    
                    return item.get('hidden') == false;
                });
    
                grid.suspendEvents();
                //grid.store.suspendEvents();
                grid.getView().suspendEvents();
                for (var i = 0; i < 10000; i++) {
                    toAdd.push({
                        id: i,
                        company: 'company' + i,
                        hidden: i % 3 == 0
                    });
    
                }
    
                grid.store.add(toAdd);
                grid.resumeEvents();
                //grid.store.resumeEvents();
                grid.getView().resumeEvents();
            }
    
    
        </script>
    
    
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" Namespace="" Theme="Gray" />
    
    
            <ext:Viewport runat="server" Layout="fit">
                <Items>
                    <ext:Panel runat="server" id="rootPanel">
                        <LayoutConfig>
                            <ext:BorderLayoutConfig />
                        </LayoutConfig>
                        <Items>
                            <ext:Panel runat="server" Region="West" Title="Menu" Width="300" ID="menuPanel">
                                <LayoutConfig>
                                    <ext:VBoxLayoutConfig Align="Stretch" />
                                </LayoutConfig>
                                <Items>
                                    <ext:Button runat="server" OnClientClick="simulateProblem()" Text="Simulate problem"></ext:Button>
                                </Items>
                            </ext:Panel>
                            <ext:Container runat="server" Region="Center" flex="1" id="centerContainer">
                                <LayoutConfig>
                                    <ext:VBoxLayoutConfig Align="Stretch" />
                                </LayoutConfig>
                                <Items>
                                    <ext:Container runat="server" Layout="vbox">
                                        <LayoutConfig>
                                            <ext:VBoxLayoutConfig Align="Stretch" />
                                        </LayoutConfig>
                                        <Items>
    
    
                                            <ext:GridPanel Flex="1"
                                                ID="GridPanel1"
                                                runat="server"
                                                Title="Array Grid"
                                                Width="800"
                                                Height="300">
                                                <Store>
                                                    <ext:Store ID="Store1" runat="server" AutoLoad="True" PageSize="10" RemoteSort="false" RemotePaging="false">
                                                        <Model>
                                                            <ext:Model runat="server" IDProperty="id">
                                                                <Fields>
                                                                    <ext:ModelField Name="id" />
                                                                    <ext:ModelField Name="company" />
                                                                    <ext:ModelField Name="hidden" Type="Boolean" />
                                                                </Fields>
                                                            </ext:Model>
                                                        </Model>
    
                                                    </ext:Store>
                                                </Store>
                                                <ColumnModel runat="server">
                                                    <Columns>
                                                        
                                                        <ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
    
                                                        <ext:ComponentColumn DataIndex="company" Text="Company" Flex="1" runat="server" Editor="true">
                                                            <Component>
                                                                <ext:TextField runat="server" MaxLength="64" />
                                                            </Component>
                                                        </ext:ComponentColumn>
                                                        <ext:ComponentColumn DataIndex="IsRetired" Text="Retired" runat="server" Editor="true">
                                                            <Component>
                                                                <ext:Checkbox runat="server" />
                                                            </Component>
                                                        </ext:ComponentColumn>
                                                        <ext:CommandColumn Width="70">
                                                            <Commands>
                                                                <ext:GridCommand Icon="BinClosed" CommandName="Delete" Text="Delete">
                                                                    <ToolTip Text="Delete" />
                                                                </ext:GridCommand>
                                                            </Commands>
                                                        </ext:CommandColumn>
    
                                                    </Columns>
                                                </ColumnModel>
                                                <SelectionModel>
                                                    <ext:RowSelectionModel runat="server" Mode="Multi" />
                                                </SelectionModel>
                                                <View>
                                                    <ext:GridView runat="server" StripeRows="true" />
                                                </View>
    
                                            </ext:GridPanel>
    
                                        </Items>
                                    </ext:Container>
                                </Items>
                            </ext:Container>
                        </Items>
                    </ext:Panel>
    
    
                </Items>
            </ext:Viewport>
    
        </form>
    </body>
    </html>
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	45 
Size:	30.0 KB 
ID:	25605
    Click image for larger version. 

Name:	Capture1.PNG 
Views:	48 
Size:	36.0 KB 
ID:	25604
  2. #2
    Hello @Jirihost!

    When you use components, Ext.NET will struggle with fast scrolling and rendering grid rows in batches using GridPanel's buffered rendering.

    At first, the solution would be to simply disable buffered rendering. At the same time, as you stated, it's a "large grid", then the page overall performance will probably degrade; you'll have to see in your actual scenario if the performance is acceptable.

    In order then to increase performance, options could be:
    - display (render) components only on row selection or mouse hover,
    - completely removing components from grid (then buffered grid could be used again), making, say, 2x click to rows open a form with the interactable components
    - use grid's infinite scrolling, where it pulls a set of data when scrolling close to the currently loaded set (it's in some sense a "more granular buffered rendering", suitable for really really big grid)
    - use grid paging to limit how many rows are rendered at a time

    Some topics that already touched this subject in the past:
    - Grid - Row Commands doesn't render for some rows when scrolling too fast
    - CommandColumn not rendering

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. First record in grid has two different components. Why?
    By S.KARATHANASIS in forum 2.x Help
    Replies: 0
    Last Post: May 15, 2014, 6:49 AM
  2. [CLOSED] Slow Grid Render on Large Data with Command Column
    By amitpareek in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 08, 2013, 2:41 PM
  3. Replies: 5
    Last Post: Sep 03, 2012, 1:38 PM
  4. [CLOSED] Binding Large Set of Data to a Grid makes browser unresponsive
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 14, 2011, 4:01 PM
  5. [CLOSED] Grid Panel Filter and Sorting futures for Large data
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 16, 2010, 7:50 PM

Posting Permissions