Performance problem with dynamically sized grid

  1. #1

    Performance problem with dynamically sized grid

    Hello

    You can easilly reproduce the problem by clicking "simulate problem" in the example

    Note that problem disappear if I set height of the grid explicitelly like this

    Probably some kind of suspendEvents is required but I did not found where(grid, view, and store tried without sucess)

               <ext:GridPanel Flex="1"
                ID="GridPanel1"
                runat="server"
                Title="Array Grid"
                Width="800"
                Height="300"
    Code sample to reproduce:
    <%@ 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 = [];
               
    
                
                for (var i = 0; i < 500; i++) {
                    toAdd.push({
                        id: i,
                        company: 'company' + i,
                        hidden: i % 3 == 0
                    });
    
                }
                grid.store.add(toAdd);
    
              
            }
    
    
        </script>
    
     
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" Namespace="" Theme="Gray" />
    
    		
            <ext:Viewport runat="server">
                <Items>
                    <ext:Container runat="server" Layout="vbox">
                        <LayoutConfig>
                            <ext:VBoxLayoutConfig Align="Stretch"/>
                            </LayoutConfig>
                            <Items>
                                <ext:Button runat="server" OnClientClick="simulateProblem()" Text="Simulate problem" ></ext:Button>
                                
                                   <ext:GridPanel Flex="1"
                ID="GridPanel1"
                runat="server"
                Title="Array Grid"
                Width="800"
                
    	        >
                <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:RowNumbererColumn runat="server" Width="35" />
                        <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:Viewport>
    
        </form>
    </body>
    </html>
  2. #2
    Hello, Jiri!

    By default, since Ext.NET 3 if memory serves me well, grid panels have buffered rendering enabled by default. The way buffered rendering works requires a pre-established grid height in order to know how far ahead or behind it should preload rows into view.

    "Buffered rendering grids" makes large grids lighter into the web browser by only rendering the HTML for rows close to the viewable area of the grid, such as when you scroll down it has time to free rows "scrolled far away" and render rows "scrolled close by".

    This discussion touches the subject: About gridpanel height with BufferedRenderer.

    So, in order to maintain a dynamic height to grid panels at the same time they employ buffered rendering, what you can do is to bind, say, the window or any enclosing container (containers are panels, container, other grids, Ext window, form panels and so on) resize event to call the grid's setHeight() method.

    So, unfortunately this shoudln't help:

    Quote Originally Posted by jirihost
    Probably some kind of suspendEvents is required but I did not found where(grid, view, and store tried without sucess)
    But, if you can afford to run that grid without buffered rendering (mind also the audience, clients' browsers being able to handle it smoothly) you could then keep without the height being specified.

    In the example though, you can just add a fit layout to the viewport (or a height to it) and the grid should load much faster.

    In fact, without the layout or height in viewport, the grid loads as slow as it would if buffered rendering was disabled. So perhaps the best choice here would be to limit the amount of rows to display, by using grid paging or selectively showing components as they are really needed. That is, if you really require to include a complex component in every single row.

    Another alternative would be to use one of the various grid editing techniques to only show the components when one really wants to edit what's in that row. A row editor maybe?

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Jiri!

    It's been a while since we replied to your inquire and still no feedback from you. Do you need further help with this issue?

    We may mark this thread as closed in 7+ days from now if you don't post back. Closed threads are not locked, so you would still be able to post a follow-up at your convenience.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 6
    Last Post: Nov 21, 2022, 11:21 PM
  2. Replies: 5
    Last Post: Jan 16, 2012, 8:50 AM
  3. Replies: 7
    Last Post: Jun 03, 2011, 9:18 PM
  4. Replies: 5
    Last Post: Feb 16, 2010, 6:02 PM
  5. [CLOSED] Performance problem in IE6
    By danielg in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 28, 2009, 11:08 AM

Posting Permissions