How to use directStore in Ext.Net version 2.3

  1. #1

    How to use directStore in Ext.Net version 2.3

    I upgrade my project from Ext.Net version 1.0 to version 2.3. OnRefreshData function for store never get called. Do you have any sample code to show me how to use store in version 2.3.

    Here are my code. Can you see what's wrong with code?

    Server side function:
    protected void storeData_Refresh(object sender, StoreReadDataEventArgs e)
            {
                try
                {
    
                    int docTypeID = int.Parse(this.Request.QueryString["doctypeid"]);
    
                    DocTypesWrapper docType = DocTypesWrapper.FindById(docTypeID);
    
                    DataTable dt;
    
                    if (this.Request.QueryString["isquery"] == "0")
                    {
                        dt = DocumentsWrapper.FindEmptyDataTableByOrderByAndFilterAndKeywords(docTypeID);
                        e.Total = 0;
                    }
                    else
                    {
                        int recordCount = 0;
    
                        string sortFieldName = "";
                        if (e.Sort != null)
                            sortFieldName = e.Sort[0].ToString();
    
                        int startIndex = 0;
    
                        if (e.Start > -1)
                        {
                            startIndex = e.Start;
                        }
    
                        int limit = this.storeData.PageSize;
    
    
                        int pageIndex = 1;
    
                        if ((startIndex % limit) == 0)
                            pageIndex = startIndex / limit + 1;
                        else
                            pageIndex = startIndex / limit;
    
                        if (sortFieldName == "FileType")
                        {
                            sortFieldName = "DocumenFileType";
                        }
                        List<SystemRoleEntity> roleEntity = null;
                        if (Session["LdapAuth"].ToString() == "true")
                            roleEntity = (List<SystemRoleEntity>)Session["RoleEntity"];
    
                        dt = DocumentsWrapper.SearchDocument(GetFilter(), this.CurrentLoginUser.UserLoginID, roleEntity,
                                                            docType.DocTypeID, sortFieldName, (e.Sort[0].Direction == Ext.Net.SortDirection.DESC), pageIndex, limit, out  recordCount);
    
    
    
                        DataColumn key = new DataColumn("ID", typeof(int));
    
                        key.AutoIncrement = true;
    
                        dt.Columns.Add(key);
    
                        dt.AcceptChanges();
    
    
                        e.Total = recordCount;
    
                    }
    
                    //if (storeData.Reader.Count == 0)
                    //    storeData.Reader.Add(GetJsonReaderByDataTable(dt, docType));
    
                    this.storeData.DataSource = dt;
    
                    int dtrow = dt.Rows.Count;
                    if (dtrow == 1)
                    {
                        DisplayFlag = "1"; 
                    }
                }
                catch (Exception ex)
                {
                    string strmsg = "Error in DocGridList::storeData_Refresh: " + ex.Message;
                    ErrorLog.WriteErrorLog(strmsg, Application["ErrorFile"].ToString());
                }
            }
    client side code:
    <script type="text/javascript">
             var RefreshData = function(btn) {
                <%= this.storeData.ClientID %>.reload();
            };  
            
            
            function ReloadData(){
                <%= this.storeData.ClientID %>.reload();
            };   
       </script>
    <ext:Store ID="storeData" runat="server" AutoLoad="true" RemoteSort="true" OnRefreshData="storeData_Refresh" PageSize="30" >
            <AutoLoadParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="30" Mode="Raw" />
            </AutoLoadParams>
            <Parameters>
                <ext:StoreParameter Name="docTypeID" Value="1" Mode="Value" />
                <ext:StoreParameter Name="searchCondition" Value="NA" Mode="Value" />
            </Parameters> 
            <Proxy>
                <ext:PageProxy>
                  <RequestConfig  Timeout="30000"></RequestConfig >
                </ext:PageProxy>
            </Proxy> 
        </ext:Store>
  2. #2
    Replace OnRefreshData by OnReadData
    https://examples2.ext.net/#/GridPane...rayWithPaging/
  3. #3

    OnReadData works

    Thanks. OnReadData works.

    Quote Originally Posted by Vladimir View Post
    Replace OnRefreshData by OnReadData
    https://examples2.ext.net/#/GridPane...rayWithPaging/

Similar Threads

  1. Replies: 0
    Last Post: Jun 15, 2012, 8:42 AM
  2. Replies: 3
    Last Post: Mar 27, 2012, 6:23 PM
  3. Replies: 1
    Last Post: Mar 12, 2012, 9:31 PM
  4. Replies: 2
    Last Post: Jan 26, 2010, 12:54 PM
  5. Version 0.6.0 BUG
    By _Eduardo_c_ in forum Bugs
    Replies: 3
    Last Post: Oct 25, 2008, 9:00 PM

Posting Permissions