PDA

View Full Version : [CLOSED] Delay firing of Direct Method ...



rthiney
Apr 09, 2014, 11:09 PM
I have a gridpanel with a checkbox column.
When the checkbox is checked/unchecked, it fires an ajax call to update data using a handler...
The problem is that if a user runs down the list really quick, it fires a bunch of times...

The return of the direct method causes the entire grid to refresh...

Any good ideas? Any simple way?

I just want to be able to cancel a call, or not reload the grid if there is a pending call...

Does the "Delay" effectively cancel any previous calls? Or do they Q up and after a 5 second delay are you left with 10 calls that are going to fire?


This fires after each "check"


$.ajax({
type: "POST",
url: "/Handler/BalanceSheetGridUpdateHandler.ashx",
data: JSON.stringify(arrChanges),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (msg) {

scripts.messageTop('Error', msg.responseText, 'danger');
},
success: function (response) {

App.ContentPlaceHolder1_store.load(); <--this then reloads the entire grid...

}
});


The store is configured as such:



<Store>
<ext:Store ID="store" runat="server" GroupField="GroupTitle">
<Proxy>
<ext:AjaxProxy Json="true" Url="/Handler/PerformanceMetricsGridHandler.ashx">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="records" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Parameters>
<ext:StoreParameter Name="metricType" Value="#{hidMetricType}.getValue()" Mode="Raw" />
<ext:StoreParameter Name="docId" Value="#{hidDocumentId}.getValue()" Mode="Raw" />
</Parameters>
<Sorters>
</Sorters>
<Listeners>
<Refresh Handler="footnoteCount=0;#{storeFootnotes}.load(); " />
<Load Handler="footnoteCount=0;#{storeFootnotes}.load();" />
</Listeners>
</ext:Store>
</Store>

Daniil
Apr 10, 2014, 5:28 PM
Hi @rthiney,

It might be enough to use the Buffer setting for a listener which you use listen to check/uncheck events.