[CLOSED] GridPanel is not refreshing

  1. #1

    [CLOSED] GridPanel is not refreshing

    Hi ,

    i have GridPanel with Store control.i am adding new record and saving it ,but gridpanel not reloads.if refresh page then records displayed.

    i am just buinding list to store control. code as follows ...plz check it..




    <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" Frame="true"


    Width="900" Height="475">


    <Body>


    <ext:Store runat="server" ID="Store1" AutoLoad="true" RemoteSort="true" OnRefreshData="Store1_RefreshData">


    <Proxy>


    <ext:DataSourceProxy />


    </Proxy>


    <Reader>


    <ext:JsonReader ReaderID="buyerID">


    <Fields>


    <ext:RecordField Name="buyerID" />


    <ext:RecordField Name="toWhomeTransPorted" />


    <ext:RecordField Name="transportedAddress" />


    <ext:RecordField Name="commodityName" />


    <ext:RecordField Name="quantityorWeight" />


    <ext:RecordField Name="value" />


    <ext:RecordField Name="invoiceNo" />


    </Fields>


    </ext:JsonReader>


    </Reader>


    <AutoLoadParams>


    <ext:Parameter Name="start" Value="0" Mode="Raw" />


    <ext:Parameter Name="limit" Value="10" Mode="Raw" />


    </AutoLoadParams>


    <SortInfo Field="ToWhomeTransPorted" Direction="ASC" />


    </ext:Store>


    <ext:GridPanel runat="server" ID="GridPanel1" StoreID="Store1" Title="Buyers Information"


    Height="300" Header="true" Icon="Lorry" StripeRows="true">


    <ColumnModel ID="ColumnModel1" runat="server">


    <Columns>


    <ext:Column ColumnID="buyerID" Header="Buyer ID" DataIndex="buyerID" Sortable="true"


    Hidden="true">


    </ext:Column>


    <ext:Column Header="To Whome TransPorted" DataIndex="toWhomeTransPorted" Sortable="true"


    Width="150" />


    <ext:Column Header="Transported Address" DataIndex="transportedAddress" Sortable="true"


    Width="150" />


    <ext:Column Header="Commodity Name" DataIndex="commodityName" Sortable="true" Width="100" />


    <ext:Column Header="Quantity/Weight" DataIndex="quantityorWeight" Sortable="true"


    Width="100" />


    <ext:Column Header="Value" DataIndex="value" Sortable="true" Width="100" />


    <ext:Column Header="Invoice No" DataIndex="invoiceNo" Sortable="true" Width="100" />


    </Columns>


    </ColumnModel>


    <SelectionModel>


    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />


    </SelectionModel>


    <LoadMask ShowMask="true" />


    <SaveMask ShowMask="true" />


    <BottomBar>


    <ext:PagingToolBar ID="PagingToolBar1" runat="server" PageSize="5" DisplayInfo="true"


    DisplayMsg="Displaying buyers {0} - {1} of {2}" EmptyMsg="No buyers to display" />


    </BottomBar>


    <AjaxEvents>


    <RowClick OnEvent="SaveRowID">


    <ExtraParams>


    <ext:Parameter Name="id" Value="params[0].getStore().getAt(params[1]).id" Mode="Raw" />


    </ExtraParams>


    </RowClick>


    </AjaxEvents>


    <Buttons>


    <ext:Button ID="btnAddBuyer" runat="server" Text="Add Buyer" Icon="Add">


    <AjaxEvents>


    <Click OnEvent="ShowNewPopUP" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">





    <ExtraParams>


    <ext:Parameter Name="id" Value='ADD' Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    <ext:Button ID="btnUpdaetBuyer" runat="server" Text="Edit Buyer" Icon="Disk">


    <AjaxEvents>


    <Click OnEvent="ShowPopUP" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">


    <ExtraParams>


    <ext:Parameter Name="id" Value='Edit' Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    <ext:Button ID="DeleteButton" runat="server" Text="Delete Buyer" Icon="Delete">


    <AjaxEvents>


    <Click OnEvent="DeleteSelectedRecord" Success="Ext.Msg.alert('Delete', 'Deleted');">


    <ExtraParams>


    <ext:Parameter Name="id" Value="1" Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    </Buttons>


    </ext:GridPanel>


    </Body>


    </ext:Panel>



  2. #2

    RE: [CLOSED] GridPanel is not refreshing

    Hi,

    I don't see how you add new rocrd, save and rebind. Can you show full sample?*
  3. #3

    RE: [CLOSED] GridPanel is not refreshing



    Hi,

    i have a tab control in one of tab i have store control and GridPanel.

    code as ...

    code behind as follows...





    protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)


    {


    try


    {





    List<BuyerTransferObject> list = (List<BuyerTransferObject>)Session["Buyers"];


    Store1.DataSource = list.ToList();


    Store1.DataBind();








    }


    catch (Exception ex)


    {








    Coolite.Ext.Web.ScriptManager.GetCurrent(Page).Add Script("Ext.Msg.alert('Error:', '" + ex.Message.ToString() + "');");





    }


    }

    //just add items to list to bing to grid.
    protected void SaveBuyer(object sender, AjaxEventArgs e)


    {


    try


    {


    <BuyerTransferObject> list = new List<BuyerTransferObject>();


    BuyerTransferObject b = new BuyerTransferObject();


    b.buyerID = 1;


    b.toWhomeTransPorted = txtToWhomeTransPorted.Text;


    b.transportedAddress = txtToWhomeTransPortedAddress.Text;


    b.commodityName = ddlCommodityName.SelectedItem.Text;


    b.quantityorWeight = txtQuantity.Text;


    b.value = Convert.ToInt32(txtValue.Text);


    b.invoiceNo = txtInvoiceNo.Text;


    list.Add(b);


    //Binding data.


    Store1.DataSource = list;//generic list


    Store1.DataBind();


    }

    }







    <ext:Tab ID="Tab2" runat="server" Title="Buyer Info" AutoHeight="true" Icon="Anchor">


    <Body>


    <ext:ColumnLayout ID="ColumnLayout2" runat="server">


    <ext:LayoutColumn ColumnWidth=".5">


    <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" Frame="true"


    Width="900" Height="475">


    <Body>


    <ext:Store runat="server" ID="Store1" AutoLoad="true" RemoteSort="true" OnRefreshData="Store1_RefreshData">


    <Proxy>


    <ext:DataSourceProxy />


    </Proxy>


    <Reader>


    <ext:JsonReader ReaderID="buyerID">


    <Fields>


    <ext:RecordField Name="buyerID" />


    <ext:RecordField Name="toWhomeTransPorted" />


    <ext:RecordField Name="transportedAddress" />


    <ext:RecordField Name="commodityName" />


    <ext:RecordField Name="quantityorWeight" />


    <ext:RecordField Name="value" />


    <ext:RecordField Name="invoiceNo" />


    </Fields>


    </ext:JsonReader>


    </Reader>


    <AutoLoadParams>


    <ext:Parameter Name="start" Value="0" Mode="Raw" />


    <ext:Parameter Name="limit" Value="10" Mode="Raw" />


    </AutoLoadParams>


    <SortInfo Field="ToWhomeTransPorted" Direction="ASC" />


    </ext:Store>


    <ext:GridPanel runat="server" ID="GridPanel1" StoreID="Store1" Title="Buyers Information"


    Height="300" Header="true" Icon="Lorry" StripeRows="true">


    <ColumnModel ID="ColumnModel1" runat="server">


    <Columns>


    <ext:Column ColumnID="buyerID" Header="Buyer ID" DataIndex="buyerID" Sortable="true"


    Hidden="true">


    </ext:Column>


    <ext:Column Header="To Whome TransPorted" DataIndex="toWhomeTransPorted" Sortable="true"


    Width="150" />


    <ext:Column Header="Transported Address" DataIndex="transportedAddress" Sortable="true"


    Width="150" />


    <ext:Column Header="Commodity Name" DataIndex="commodityName" Sortable="true" Width="100" />


    <ext:Column Header="Quantity/Weight" DataIndex="quantityorWeight" Sortable="true"


    Width="100" />


    <ext:Column Header="Value" DataIndex="value" Sortable="true" Width="100" />


    <ext:Column Header="Invoice No" DataIndex="invoiceNo" Sortable="true" Width="100" />


    </Columns>


    </ColumnModel>


    <SelectionModel>


    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />


    </SelectionModel>


    <LoadMask ShowMask="true" />


    <SaveMask ShowMask="true" />


    <BottomBar>


    <ext:PagingToolBar ID="PagingToolBar1" runat="server" PageSize="5" DisplayInfo="true"


    DisplayMsg="Displaying buyers {0} - {1} of {2}" EmptyMsg="No buyers to display" />


    </BottomBar>


    <AjaxEvents>


    <RowClick OnEvent="SaveRowID">


    <ExtraParams>


    <ext:Parameter Name="id" Value="params[0].getStore().getAt(params[1]).id" Mode="Raw" />


    </ExtraParams>


    </RowClick>


    </AjaxEvents>


    <Buttons>


    <ext:Button ID="btnAddBuyer" runat="server" Text="Add Buyer" Icon="Add">


    <AjaxEvents>


    <Click OnEvent="ShowNewPopUP" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">





    <ExtraParams>


    <ext:Parameter Name="id" Value='ADD' Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    <ext:Button ID="btnUpdaetBuyer" runat="server" Text="Edit Buyer" Icon="Disk">


    <AjaxEvents>


    <Click OnEvent="ShowPopUP" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">


    <ExtraParams>


    <ext:Parameter Name="id" Value='Edit' Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    <ext:Button ID="DeleteButton" runat="server" Text="Delete Buyer" Icon="Delete">


    <AjaxEvents>


    <Click OnEvent="DeleteSelectedRecord" Success="Ext.Msg.alert('Delete', 'Deleted');">


    <ExtraParams>


    <ext:Parameter Name="id" Value="1" Mode="Value" />


    </ExtraParams>


    </Click>


    </AjaxEvents>


    </ext:Button>


    </Buttons>


    </ext:GridPanel>


    </Body>


    </ext:Panel>


    </ext:LayoutColumn>


    </ext:ColumnLayout>


    </Body>


    </ext:Tab>






    please chaeck it once ..


    thanks
    satya
  4. #4

    RE: [CLOSED] GridPanel is not refreshing

    Hi,

    It is difficult to understand the whole picture on the scattered pieces of code. After calling SaveBuyer*you should see one record in grid (if you don't perform any other actions in the request).


    Can you show full sample which we can test and reproduce the problem?


    If code is private then you can send it to the*


    support at coolite dot com
  5. #5

    RE: [CLOSED] GridPanel is not refreshing



    Hi valdsch,

    I attached the simpled files please check it.
    Here data binding properly to Store control but not updating in gridpanel.
    if miss any thing plz update me.

    thanks,
    satya
  6. #6

    RE: [CLOSED] GridPanel is not refreshing



    Hi ,

    aspx page not uploaded properly i uploaded again valdsch..

    thanks,
    satya
  7. #7

    RE: [CLOSED] GridPanel is not refreshing

    Hi,

    Can you provide more details what is incorrect in your example? I ran it and it works properly (record is added to grid after clicking on Save button). One mistake I found that you are always create new list in save handler. Therefore in your grid one record only. You need restore list from session

    Here is my test case which works fine
    <%@ Page Language="C#"  %>
    <%@ Import Namespace="System.Collections.Generic"%>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!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 id="Head1" runat="server">
        <title>Untitled Page</title>
        
        <script runat="server">
            protected void SaveRowID(object sender, AjaxEventArgs e)
            {
                Session["BuyerRowID"] = e.ExtraParams["id"].ToString();
            }
    
    
            protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
    
                if (Session["Buyers"] != null)
                {
                    List<Buyer> list = (List<Buyer>)Session["Buyers"];
                    Store1.DataSource = list;
                    Store1.DataBind();
    
                }
    
            }
    
            protected void SaveBuyer(object sender, AjaxEventArgs e)
            {
    
                List<Buyer> list = (Session["Buyers"] as List<Buyer>) ?? new List<Buyer>();
                Buyer b = new Buyer();
                b.BuyerID = list.Count+1;
                b.ToWhomeTransPorted = txtToWhomeTransPorted.Text;
                b.TransportedAddress = txtToWhomeTransPortedAddress.Text;
                b.CommodityName = ddlCommodityName.SelectedItem.Text;
                b.QuantityorWeight = txtQuantity.Text;
                b.Value = Convert.ToInt32(txtValue.Text);
                b.InvoiceNo = txtInvoiceNo.Text;
                list.Add(b);
                Session["Buyers"] = list;
    
                Store1.DataSource = list;
                Store1.DataBind();
    
    
                BuyerDetailswindow.Hide();
    
            }
    
            protected void ShowNewPopUP(object sender, AjaxEventArgs e)
            {
                BuyerDetailswindow.Show();
    
            }
    
            public class Buyer
            {
    
                public int BuyerID
                {
                    get;
                    set;
                }
    
    
                public int SaleID
                {
                    get;
                    set;
                }
    
    
                public string ToWhomeTransPorted
                {
                    get;
                    set;
                }
    
    
                public string TransportedAddress
                {
                    get;
                    set;
                }
    
                public string CommodityName
                {
                    get;
                    set;
                }
    
    
                public string QuantityorWeight
                {
                    get;
                    set;
                }
    
                public int Value
                {
                    get;
                    set;
                }
    
                public string InvoiceNo
                {
                    get;
                    set;
                }
    
            }
    
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Store runat="server" ID="Store1" AutoLoad="true" RemoteSort="true" OnRefreshData="Store1_RefreshData">
                <Proxy>
                    <ext:DataSourceProxy />
                </Proxy>
                <Reader>
                    <ext:JsonReader ReaderID="BuyerID">
                        <Fields>
                            <ext:RecordField Name="BuyerID" />
                            <ext:RecordField Name="ToWhomeTransPorted" />
                            <ext:RecordField Name="TransportedAddress" />
                            <ext:RecordField Name="CommodityName" />
                            <ext:RecordField Name="QuantityorWeight" />
                            <ext:RecordField Name="Value" />
                            <ext:RecordField Name="InvoiceNo" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
                <AutoLoadParams>
                    <ext:Parameter Name="start" Value="0" Mode="Raw" />
                    <ext:Parameter Name="limit" Value="10" Mode="Raw" />
                </AutoLoadParams>
                <SortInfo Field="ToWhomeTransPorted" Direction="ASC" />
            </ext:Store>
            
            <ext:GridPanel runat="server" ID="GridPanel1" StoreID="Store1" Title="Buyers Information"
                Height="300" Header="true" Icon="Lorry" StripeRows="true">
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column ColumnID="BuyerID" Header="Buyer ID" DataIndex="BuyerID" Sortable="true"
                            Hidden="true">
                        </ext:Column>
                        <ext:Column Header="To Whome TransPorted" DataIndex="ToWhomeTransPorted" Sortable="true"
                            Width="150" />
                        <ext:Column Header="Transported Address" DataIndex="TransportedAddress" Sortable="true"
                            Width="150" />
                        <ext:Column Header="Commodity Name" DataIndex="CommodityName" Sortable="true" Width="100" />
                        <ext:Column Header="Quantity/Weight" DataIndex="QuantityorWeight" Sortable="true"
                            Width="100" />
                        <ext:Column Header="Value" DataIndex="Value" Sortable="true" Width="100" />
                        <ext:Column Header="Invoice No" DataIndex="InvoiceNo" Sortable="true" Width="100" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                </SelectionModel>
                <LoadMask ShowMask="true" />
                <SaveMask ShowMask="true" />
                <BottomBar>
                    <ext:PagingToolBar ID="PagingToolBar1" runat="server" PageSize="5" DisplayInfo="true"
                        DisplayMsg="Displaying buyers {0} - {1} of {2}" EmptyMsg="No buyers to display" />
                </BottomBar>
                <AjaxEvents>
                    <RowClick OnEvent="SaveRowID">
                        <ExtraParams>
                            <ext:Parameter Name="id" Value="params[0].getStore().getAt(params[1]).id" Mode="Raw" />
                        </ExtraParams>
                    </RowClick>
                </AjaxEvents>
                <Buttons>
                    <ext:Button ID="btnAddBuyer" runat="server" Text="Add Buyer" Icon="Add">
                        <AjaxEvents>
                            <Click OnEvent="ShowNewPopUP" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
                                <ExtraParams>
                                    <ext:Parameter Name="id" Value='ADD' Mode="Value" />
                                </ExtraParams>
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                </Buttons>
            </ext:GridPanel>
            
            <ext:Window ID="BuyerDetailsWindow" runat="server" Icon="Group" Title="Buyer Details"
                Width="400" Height="400" AutoShow="false" Modal="true" Show&#111;nload="false">
                <Body>
                    <ext:FitLayout ID="FitLayout1" runat="server">
                        <ext:Panel ID="pnlAddBuyer" runat="server" Border="false" ButtonAlign="Center" BodyStyle="paddingLeft:20px;paddingRight:10px;paddingTop:25px;">
                            <Body>
                                <ext:ColumnLayout ID="ColumnLayout3" runat="server">
                                    <ext:LayoutColumn ColumnWidth=".5">
                                        <ext:Panel ID="Panel6" runat="server" Border="false" Header="false">
                                            <Body>
                                                <ext:FormLayout ID="FormLayout3" runat="server" LabelAlign="Left" LabelWidth="160">
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtToWhomeTransPorted" runat="server" FieldLabel="To Whom transported (Buyer)" />
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtToWhomeTransPortedAddress" runat="server" FieldLabel="Address" />
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:ComboBox ID="ddlCommodityName" runat="server" Width="230" FieldLabel="Commodity Name">
                                                            <Items>
                                                                <ext:ListItem Text="Name1" />
                                                                <ext:ListItem Text="Name2" />
                                                                <ext:ListItem Text="Name3" />
                                                                <ext:ListItem Text="Name4" />
                                                                <ext:ListItem Text="Name5" />
                                                            </Items>
                                                        </ext:ComboBox>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtQuantity" runat="server" FieldLabel="Quantity" />
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:NumberField ID="txtValue" runat="server" FieldLabel="Value" />
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtInvoiceNo" runat="server" FieldLabel="Invoice No" />
                                                    </ext:Anchor>
                                                </ext:FormLayout>
                                            </Body>
                                        </ext:Panel>
                                    </ext:LayoutColumn>
                                </ext:ColumnLayout>
                            </Body>
                            <Buttons>
                                <ext:Button ID="btnSaveBuyerInfo" runat="server" Text="Save" Icon="Disk">
                                    <AjaxEvents>
                                        <Click OnEvent="SaveBuyer">
                                            <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{BuyerDetailsWindow}.body}" />
                                        </Click>
                                    </AjaxEvents>
                                </ext:Button>
                                <ext:Button ID="btnCancel" runat="server" Text="Cancel">
                                    <Listeners>
                                        <Click Handler="#{BuyerDetailsWindow}.hide(null);" />
                                    </Listeners>
                                </ext:Button>
                            </Buttons>
                        </ext:Panel>
                    </ext:FitLayout>
                </Body>
            </ext:Window>
            
        
    
        </form>
    </body>
    </html>
  8. #8

    RE: [CLOSED] GridPanel is not refreshing

    Hi,

    Thanks for your quick reply..

    I ran the same code which you sent but again it looks same when i refresh the page only new record binding to grid.once refresh happens it works fine.
    only one thing i changed i am creating new instance of list for each new record to bind only one record to grid.


    regards
    satya





  9. #9

    RE: [CLOSED] GridPanel is not refreshing

    Hi,

    Do you use latest version? Please update from SVN and retest. It should works (at least for me record has been added to grid after the window closing).*
  10. #10

    RE: [CLOSED] GridPanel is not refreshing



    Hi ,

    I found my mistake only problem is using..



    <Proxy>


    <ext:DataSourceProxy />


    </Proxy>

    this tag in store control.if remove problem sloved.

    thanks..
    satya

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. [CLOSED] Refreshing on GridPanel not working
    By mcdonald in forum 1.x Legacy Premium Help
    Replies: 19
    Last Post: Oct 27, 2010, 3:06 PM
  4. Refreshing a tab on activate
    By Lucasite in forum 1.x Help
    Replies: 0
    Last Post: May 10, 2010, 7:30 PM
  5. [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

Posting Permissions