Cannot get data in store in client side

  1. #1

    Cannot get data in store in client side

    I have Ext:Store defined in aspx page. and on page_load I assign datasource to it and bind to datasource. I steped in the code and make sure there is data in datasource. but in the client side I cannot get data in the store. Can you take a look at the code if there are anyting wrong?

    Server side code in Page_Onload:
                   DataTable dt = new DataTable();
                    dt.Columns.Add(new DataColumn("PageID", typeof(int)));
                    dt.Columns.Add(new DataColumn("PageUrl", typeof(string)));
                    dt.Columns.Add(new DataColumn("FileName", typeof(string)));
                    dt.Columns.Add(new DataColumn("BatchNumber", typeof(string)));
                    dt.Columns.Add(new DataColumn("IsDocumented", typeof(bool)));
                    dt.Columns.Add(new DataColumn("CreatedDate", typeof(DateTime)));
                    dt.Columns.Add(new DataColumn("PageCount", typeof(int)));
                    dt.Columns.Add(new DataColumn("FileExt", typeof(string)));
                    dt.Columns.Add(new DataColumn("CreatedBy", typeof(string)));
                    dt.Columns.Add(new DataColumn("DocumentBy", typeof(string)));
    
                    dt.AcceptChanges();
    
                    List<PagesWrapper> showPages = PagesWrapper.FindAllByDocIDandTypeNoLock(GetDocumentID(), GetFileType());
    
                    if (showPages.Count > 0)
                    {
                        initPageID = showPages[0].PageID;
                    }
                    int pageid = 0;
                    foreach (PagesWrapper page in showPages)
                    {
                        //BindPagerInfo(page);
                                            
                        DataRow dr = dt.NewRow();
                        dr["PageID"] = page.PageID;
                        dr["PageUrl"] = "";
                        dr["FileName"] = page.FileName;
                        dr["BatchNumber"] = page.BatchNumber;
                        dr["IsDocumented"] = page.IsDocumented;
                        dr["CreatedDate"] = page.CreatedDate;
                        dr["FileExt"] = page.FileExt;
                        dr["CreatedBy"] = page.DisplayCreateBy;
                        dr["DocumentBy"] = page.DisplayDocumentedBy;
                        if (page.PageCount == null && page.PageCount == 0)
                        {
                            try
                            {
                                dr["PageCount"] = DocumentsWrapper.CalculatePageSize(page.FileExt, page.GetFileContent(), DotImageDocumentProcessor.GetDocumentProcessor());
                            }
                            catch (Exception ex)
                            {
                                dr["PageCount"] = 1;
                            }
                        }
                        else
                        {
                            dr["PageCount"] = page.PageCount;
                        }
    
                        dt.Rows.Add(dr);
                        //}
                    }
    
                    dt.AcceptChanges();
    
                    storePageData.DataSource = dt;
                    storePageData.DataBind();
    on client side page code:
    <ext:Store ID="storePageData" runat="server">
           <Model>
                 <ext:Model runat="server" IDProperty="PageID">
                      <Fields>
                           <ext:ModelField Name="PageID" Type="Int"/>
                           <ext:ModelField Name="PageUrl" Type="String" />
                           <ext:ModelField Name="FileName" Type="String" />
                           <ext:ModelField Name="BatchNumber" Type="String" />
                           <ext:ModelField Name="IsDocumented" Type="Int" />
                           <ext:ModelField Name="CreatedDate" Type="Date" DateFormat="M/d hh:mmtt" />
                           <ext:ModelField Name="PageCount" Type="Int" />
                           <ext:ModelField Name="FileExt" Type="String" />
                           <ext:ModelField Name="CreatedBy" Type="String" />
                           <ext:ModelField Name="DocumentBy" Type="String" />
                       </Fields>
                   </ext:Model>
              </Model>           
            <Parameters>
                <ext:StoreParameter Name="pageid" Mode="Raw" Value="document.getElementById('pageid').value">
                </ext:StoreParameter>
            </Parameters>
        </ext:Store>
    client side java script code, I debug into code App.storePageData.getCount(); get 0, even it has data bind in page_load. and return App.storePageData.getById(pagerID); returned null value.

              function GetCurrentPage() {
                var pagerID = document.getElementById("pageid").value;
               var count = App.storePageData.getCount();
                return App.storePageData.getById(pagerID);
            }
  2. #2
    Hello!

    You need to investigate the generated JS code in source code of the rendered page. Try to see where is your data and how it is binded to the Store. If doesn't help post it here.

    Also you can try the following: bind data using the same approach like in this sample: http://examples2.ext.net/#/GridPanel...ata/DataTable/

Similar Threads

  1. Replies: 9
    Last Post: Oct 16, 2012, 1:05 AM
  2. Replies: 3
    Last Post: Dec 26, 2011, 2:32 PM
  3. Bind data to GridPanel Client Side
    By AnandVishnu in forum 1.x Help
    Replies: 1
    Last Post: Sep 14, 2011, 1:18 PM
  4. Replies: 1
    Last Post: Dec 01, 2010, 6:14 PM
  5. Client side created data source.
    By dan182 in forum 1.x Help
    Replies: 1
    Last Post: Jun 18, 2010, 10:59 AM

Posting Permissions