[CLOSED] Refreshing on GridPanel not working

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Refreshing on GridPanel not working

    I have a GridPanel demonstrating the Clients Infos below:

        <ext:GridPanel ID="GridPanel4" runat="server" StoreID="Store4" Border="false">
            <ColumnModel ID="ColumnModel4" runat="server">
                <Columns>
                    <ext:Column ColumnID="Id" Header="ID" Sortable="true" DataIndex="Id" Width="60" />
                    <ext:Column Header="Name" Sortable="true" DataIndex="Name" Width="100">
                    </ext:Column>
                    <ext:Column Header="Phone" Sortable="true" DataIndex="Phone" Width="120">
                    </ext:Column>
                    <ext:Column Header="Email" Sortable="true" DataIndex="Email" Width="120">
                    </ext:Column>
                    <ext:Column Header="Address" Sortable="true" DataIndex="Addr" Width="140">
                    </ext:Column>
                    <ext:Column DataIndex="Remark" Sortable="true" MenuDisabled="true" Header="Remark" Width="140">
                    </ext:Column>
                </Columns>
            </ColumnModel>
    
            <BottomBar>
                <ext:PagingToolBar ID="PagingToolBar3" runat="server" PageSize="10" StoreID="Store4" />
            </BottomBar>
        </ext:GridPanel>
    And a Store4 bind to it like this:
        <ext:Store ID="Store4" runat="server" AutoLoad="true" OnRefreshData="Store4_Refresh">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="Id" />
                        <ext:RecordField Name="Name" />
                        <ext:RecordField Name="Addr" />
                        <ext:RecordField Name="Email" />
                        <ext:RecordField Name="Phone" />
                        <ext:RecordField Name="Remark" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
    By pressing a "search" btn, the records in the grid panel are refreshed. Now I want to reload the gridpanel with all records just like it was loaded at the very beginning.

    The "Store_Refresh" method is:

            protected void Store4_Refresh(object sender, StoreRefreshDataEventArgs e)
            {
                ClientAccess ca = new ClientAccess();
                List<ClientOb> clintList = ca.GetAllClients();
    
    
                Store4.DataSource = clintList;
                Store4.DataBind();
            }
    But it was not working, donno why?
    Would you please help me?
    Last edited by Daniil; Nov 01, 2010 at 7:27 PM. Reason: [CLOSED]
  2. #2

    RE: Refreshing on GridPanel not working~~~

    Hi,

    What you mean 'don't working'?
    I think you nead demonstrate full example


  3. #3

    RE: Refreshing on GridPanel not working~~~

    Hi, I think it is working but you have to add one more line to the store refresh event handler, this how it did work for me (showed me the results after refreshing), after the
    Store4.DataBind();
    add the following line of code:
    this.GridPanel4.Reload();
    so if you are deleting a record for example, this will allow the grid to refresh after the record has been deleted and and the store has done the data binding. Hope this helps :)
  4. #4

    RE: Refreshing on GridPanel not working~~~



    no...it is still the same.

    The "search" button returns a specific record, and then I binded the record to Store4. see code below:

            protected void BtnSearch_Click(object sender, AjaxEventArgs e)
            {
                string id = TFSearchId.Value.ToString();
                ClientAccess ca = new ClientAccess();
                ClientOb client = new ClientOb();
                List<ClientOb> clients = new List<ClientOb>();
    
    
                if (id != "") 
                {
                    client = ca.GetInfoById(id);
                    clients.Add(client);
                    Store4.DataSource = clients;
                    Store4.DataBind();
                 } 
                return;
            }
    GridPanel4 properly shows this record. But when I click the refresh button in the bottom bar, everything remains.
  5. #5

    RE: Refreshing on GridPanel not working~~~

    Hi,

    Can you ensure under Debug that after click on refresh toolbar button the*Store4_Refresh server side handler is calling? Also under FireBug you can see response from server. What this response contains?


  6. #6

    RE: Refreshing on GridPanel not working~~~

    Hi,
    In the code you posted, I don't see the
    this.GridPanel.Reload();
    The second thing, since the BtnSearch_Click is an AjaxEvent, I'll assume that you have already defined the ExtraParams that would hold the specific record you are talking about for the AjaxEvent, so the correct way to get the value of the passed ExtraParams would be the following:
    string tempVal = e.ExtraParams["name of the ExtraParams"]; for example, if the Name of the ExtraParams is Name="RowVal" then the code in AjaxEvent handler will be:
    string tempVal = e.ExtraParams["RowVal"]
    try this, hope it helps :)
  7. #7

    RE: Refreshing on GridPanel not working~~~

    *Hi,

    this.GridPanel.Reload();


    is not required because it generate script which initiate on client side one more reload request to the server. Therefore calling Reload function in OnRefreshData handler can initiate loop


  8. #8

    RE: Refreshing on GridPanel not working~~~

    Hi,
    Thanks Vladsch for the tip, that is really good to know, unfortunatly, this is the only way that caused the data in GridPanel to be refreshed and in sync. with the Store automatically without hitting the refresh button in the BottomBar of the GridPanel. Thanks again.
  9. #9

    RE: Refreshing on GridPanel not working~~~

    Oh. you are right, vladimir. Can I call you eagle eye?

    the "Store4_Refresh" handler is not invoked. But donno why?
  10. #10

    RE: Refreshing on GridPanel not working~~~

    mcdonald (3/26/2009)
    I want to reload the gridpanel with all records just like it was loaded at the very beginning.
    Don't know if it's applicable to your case, but I had a gridpanel with a usercontrol inside the form tags
    Everything were ok until I added an asp:pageContent object to the user control
    I was unable to reload the darn thing until I moved the usercontrol outside the form boundaries ...

    hth
Page 1 of 2 12 LastLast

Similar Threads

  1. Refreshing....
    By nagesh in forum 1.x Help
    Replies: 8
    Last Post: Aug 02, 2012, 7:52 AM
  2. [CLOSED] Only refreshing data in GridPanel when requested
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 10, 2011, 10:03 PM
  3. Refreshing a tab on activate
    By Lucasite in forum 1.x Help
    Replies: 0
    Last Post: May 10, 2010, 7:30 PM
  4. [CLOSED] gridpanel width/height refreshing issue
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 02, 2009, 5:29 PM
  5. [CLOSED] GridPanel is not refreshing
    By Satyanarayana murthy in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Apr 28, 2009, 8:45 AM

Posting Permissions