Store callback twice on data request

  1. #1

    Store callback twice on data request

    Hi,
    After added the remote pager option to the page I get a strange behavior.
    After each call to the server to get the grid content I get a second call performed automaticaly by the Store itself calling the "onRefresh" event.
    this causes every request go twice to the server.
    any ideas ?

    thanks,
    Yossi

    Here is my code:

    my store on the .aspx file:
    
    <ext:Store ID="ConfigStore" DataSourceID="UsersUsageReportDataSource" runat="server"
            ShowWarningOnFailure="false" OnRefreshData="ConfigStore_RefreshData" OnSubmitData="Store1_Submit"
            RemoteSort="true" AutoLoad="false" AutoDataBind="false">
            <AutoLoadParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="30" Mode="Raw" />
            </AutoLoadParams>
            <Proxy>
                <ext:DataSourceProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="NumberOfRows" Type="Int" />
                        <ext:RecordField Name="ActionStatusTypeID" Type="Int" />
                        <ext:RecordField Name="ActionTypeID" Type="Int" />
                        <ext:RecordField Name="ActionTypeName" Type="String" />
                        <ext:RecordField Name="Amount" Type="Float" />
                        <ext:RecordField Name="CreatedDate" Type="Date" />
                        <ext:RecordField Name="ExtraData" Type="String" />
                        <ext:RecordField Name="ExtraMessage" Type="String" />
                        <ext:RecordField Name="PartnerName" Type="String" />
                        <ext:RecordField Name="PartnerID" Type="Int" />
                        <ext:RecordField Name="PartnerUserID" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Load failed', e.message || e )" />
                <CommitFailed Handler="Ext.Msg.alert('Commit failed', 'Reason: Timeout')" />
                <SaveException Handler="Ext.Msg.alert('Save failed', e.message || e)" />
                <CommitDone Handler="Ext.Msg.alert('Commit Succeeded', 'Data was saved')" />
            </Listeners>
            <AjaxEventConfig IsUpload="true" />
        </ext:Store>
    Here is my code-behind:
    
    protected void ConfigStore_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                //set the attributes of the search
                this.BindData(e.Start,e.Limit,e.Sort,e.Dir.ToString());
                PagerSorting.SetValue(e.Sort);
                PagerDirection.SetValue(e.Dir.ToString());
                ConfigStore.DataBind();
                
            }
     
            private void BindData()
            {
                if (!string.IsNullOrEmpty(UserIDText.Text))
                {
                    UsersUsageReportDataSource.SelectParameters.Add("UserID", UserIDText.Text);
                    ConfigStore.Reader.Reader.ReaderID = "ActionTypeID";
                }
     
                else
                {
                    UsersUsageReportDataSource.SelectParameters.Add("fromDate", FromDate.SelectedDate.ToString());
                    UsersUsageReportDataSource.SelectParameters.Add("toDate", ToDate.SelectedDate.ToString());
                    UsersUsageReportDataSource.SelectParameters.Add("PartnerID", CBoxPartners.SelectedItem.Value);
                    UsersUsageReportDataSource.SelectParameters.Add("Threshold", ThresholdField.Text);
                    UsersUsageReportDataSource.SelectParameters.Add("ActionStatusType", CboxActionStatusType.SelectedItem.Value);
                    UsersUsageReportDataSource.SelectParameters.Add("ActionType", CboxActionType.SelectedItem.Value);
                    ConfigStore.Reader.Reader.ReaderID = "PartnerUserID";
                }
            }
     
            private void BindData(int start,int limit,string sort,string dir)
            {
                BindData();
                UsersUsageReportDataSource.SelectParameters["start"].DefaultValue = start.ToString();
                UsersUsageReportDataSource.SelectParameters["limit"].DefaultValue = limit.ToString();
                UsersUsageReportDataSource.SelectParameters["sort"].DefaultValue = sort;
                UsersUsageReportDataSource.SelectParameters["dir"].DefaultValue = dir;
                
            }
  2. #2

    Do you not answer questions if you dont have an answer.

    I was wondering if you guys would answer this guys question from over a year ago. I am having the same problem this guy is and have not found an answer on your forums can you please help? If you cant answer please let me know you cant answer this one. Thank you

Similar Threads

  1. [CLOSED] [1.3] Send custom data on each request
    By John_Writers in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 04, 2012, 5:13 PM
  2. ajax request failure callback function help
    By [WP]joju in forum 1.x Help
    Replies: 1
    Last Post: Apr 30, 2010, 9:52 AM
  3. [CLOSED] Store OnRefreshData callback exectuted twice
    By jeremyl in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 09, 2009, 7:02 AM
  4. [CLOSED] [1.0] Store callback problem
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 20, 2009, 6:19 PM
  5. [CLOSED] Store + Reload Callback
    By state in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 29, 2009, 1:24 PM

Posting Permissions