Jan 31, 2010, 10:51 AM
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:
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;
}