Render 2 grids

  1. #1

    Render 2 grids

    Hello,

    I have a little problem.
    My application have 2 grids. First grid show full information and second grid show compact information grid1.

    I need control refresh because when i click refresh, the seccond grid refresh finish before than first grid refresh.

    Sorry my bad english.

    <ext:GridPanel ID:"GridPanel1" ..... >
                            <Listeners>
                                <AfterRender Handler="#{GridPanel2}.reload();" />
                            </Listeners>
    </ext:GridPanel>
    <ext:Button ID="Refresh" runat="server" Text="Refresh" Icon="ArrowRefresh" AutoPostBack="true" />
    Last edited by Daniil; Jan 25, 2011 at 2:13 PM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    I would suggest you to do not use <ext:Button> with AutoPostback="true" to refresh grids.

    You could use Click Listener with
    GridPanel1.reload()
    I would suggest you this way:

    Example
    <%@ 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)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"}
                };
                store.DataBind();
    
                store = this.GridPanel2.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] {"test4"},
                    new object[] {"test5"},
                    new object[] {"test6"}
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            Title="GridPanel1" 
            AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                    <Listeners>
                        <Load Handler="GridPanel2.load();" Delay="10" />
                    </Listeners>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        <ext:GridPanel 
            ID="GridPanel2" 
            runat="server" 
            Title="GridPanel2" 
            AutoHeight="true">
            <Store>
                <ext:Store runat="server" AutoLoad="false">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        <ext:Button runat="server" Text="Refresh">
            <Listeners>
                <Click Handler="GridPanel1.getStore().reload();" />
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Hello Everybody,

    Thanks. Problem Solved.

Similar Threads

  1. two grids rows
    By cbu in forum 1.x Help
    Replies: 8
    Last Post: Dec 15, 2011, 4:44 PM
  2. [CLOSED] Toggle Render? Refresh Render?
    By rthiney in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 08, 2011, 3:13 PM
  3. Query about Two grids example
    By Nagaraj K Hebbar in forum 1.x Help
    Replies: 1
    Last Post: Oct 13, 2009, 3:35 AM
  4. Two Grids get value
    By JsonTerre in forum 1.x Help
    Replies: 0
    Last Post: Mar 09, 2009, 11:04 PM
  5. DnD Between 2 Grids
    By davidhoyt in forum 1.x Premium Help
    Replies: 1
    Last Post: Jan 13, 2009, 2:02 AM

Posting Permissions