[CLOSED] Store records not available in client side after Grid bind in server side using Page Proxy

  1. #1

    [CLOSED] Store records not available in client side after Grid bind in server side using Page Proxy

    Hi Team,

    In the code sample provided below, we are using PageProxy to bind the grid data to the store using OnReadData server side.
    Immediately after binding the data to the grid store we need to access that store items in client side. Hence we are using the
    ResourceManager1.AddScript("SelectRow();");
    for manipulation.

    But we are not able to retrieve the records client side after loading data to the store sever side.


    App.Store1.data.items;
    returns empty
    Note: In GridPanel the added items are displayed!!!

    .aspx page
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="SSTM.WebApp.WebForm1" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>PageProxy with DirectMethod - Ext.NET Examples</title>  
        <link href="/resources/css/examples.css" rel="stylesheet" />    
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" Namespace="App" />
    
            <h1>PageProxy with DirectMethod</h1>
           
            <ext:GridPanel
                ID="GridPanel1"
                runat="server" 
                Title="Array Grid" 
                Width="700" 
                Height="310">
                <Store>
                    <ext:Store ID="Store1" runat="server" OnReadData="Store1_ReadData">
                        <Model>
                            <ext:Model ID="Model1" runat="server">
                                <Fields>
                                    <ext:ModelField Name="company" />
                                    <ext:ModelField Name="price" Type="Float" />                               
                                </Fields>
                            </ext:Model>
                        </Model>                                      
                        <Proxy>
                            <ext:PageProxy>                            
                            </ext:PageProxy>
                        </Proxy>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="35" />
                        <ext:Column ID="Column1" runat="server" Text="Company" DataIndex="company" Flex="1" />
                        <ext:Column ID="Column2" runat="server" Text="Price" Width="75" DataIndex="price">
                            <Renderer Format="UsMoney" />
                        </ext:Column>                    
                    </Columns>
                </ColumnModel>                  
            </ext:GridPanel>
        </form>
        <script>
            function SelectRow() {
                var test = App.Store1.data.items;
            }
        </script>
    </body>
    </html>
    .cs page:
    using Ext.Net;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace SSTM.WebApp
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void Store1_ReadData(object sender, StoreReadDataEventArgs e)
            {
                BindStore();
                ResourceManager1.AddScript("SelectRow();");
            }
    
            private void BindStore()
            {
                this.Store1.DataSource = new List<object>
            {
                new { company = "3m Co", price = 71.72},
                new { company = "speed step", price = 81.82}           
            };
    
                this.Store1.DataBind();            
            }
        }
    }

    Guide us to a solution!!!
    Last edited by fabricio.murta; Feb 05, 2015 at 5:02 AM. Reason: [CLOSED]
  2. #2
    Hi @speedstepmem4,

    Is it a solution for you to call SelectedRow() on the EndUpdate event?

    If you remove your ResourceManager1.AddScript() from code behind and put, inside the ext:Store tag the following markup:
                        <Listeners>
                            <EndUpdate Handler="SelectRow();" />
                        </Listeners>
    It will run your javascript function when data is already on place. The point here is to call the javascript function after the data is actually updated into the store, right?

    Let me know if this does not help you with your issue.
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Store records not available in client side after Grid bind in server side using Page Proxy

    Hi fabricio.murta

    Thanks for the guidance. Now we can retrieve the data in the store.
    Please mark this as closed!!

Similar Threads

  1. Replies: 9
    Last Post: Oct 16, 2012, 12:05 AM
  2. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  3. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  4. Replies: 1
    Last Post: Nov 01, 2010, 9:00 PM
  5. Create Simple Store and Bind to Grid Client-Side?
    By Tbaseflug in forum 1.x Help
    Replies: 4
    Last Post: Oct 30, 2009, 5:27 PM

Posting Permissions