javascript - Is there a way to abort a SlickGrid asynchronous render? -
I have a search page with the result given in SlickGrid. This is an Ajax search which is onkeyup
, So search can be done, slim. Grid insions can be called render
, and the second result comes back before the first asynchronous render
is complete. I would like to cancel the initial render
as soon as the second ajax request comes back so that there are no two calls to the same code at the same time.
Edit with an example :
I am here with a warning
to track execution order.
Function Setup Grid () {slickDataView = New Slick.Data.DataView (); Slimgrid = new slim Grid (Slimgriddiv, Slickdata. Rosho, Slachgrid Column, Slimgrid Option); SlickDataView.onRowsChanged.subscribe (function (rows) {slickGrid.removeRows (rows); slickGrid.updateRowCount (); slickGrid.render ();}); SlickDataView.onRowCountChanged.subscribe (Functions) {slickGrid.updateRowCount (); slickGrid.render ();}); } Function performSearch () {jQuery.get ('searchPage.php', {MODEL_ID: userInputField.val ()}, function (result) {slickDataView.beginUpdate (); Alert (1); slickDataView.setItems (Results); Alert (2); slickDataView.endUpdate ();}); } Setup Grid (); UserInputField.keyup (function () {performSearch ();});
I get the following alerts in this sequence when I type two numbers in the userInputField
text field in the quick code:
< Code> 1 2 2
Something else should be on your page. The example you listed is impossible - Javascript execution is removed from an event that never removes. After executing the current code, the event is only queued and lifted up to the incident rope. What you will see in your example, it is 1212.
You want to suppress AJAX calls and would like to cancel callback from previous calls because your AJAX responses may be out of order and old search results may override new ones.
Comments
Post a Comment