Results 1 to 2 of 2

Thread: Grid + ajax timing issues

  1. #1
    Sencha User
    Join Date
    Mar 2011

    Default Grid + ajax timing issues

    Hi all,

    Using Extjs 3.2.1 here, because of a GeoExt requirement.

    I have a Grid with checkboxes (using CheckboxSelectionModel). The checkbox selection handler fetches a data record from the server through an Ajax request, and then extends an in-memory array with that record.
    The checkbox UNselection handler removes that same record from the in-memory array.

    Now, the problem: if I click twice very fast on a checkbox, then the Ajax call from the select handler hasn't returned when the unselect handler is called, and my in-memory array does not contain the requested data record yet.
    Result: the unselect handler does not remove anything from the array (since the record isn't there yet), and *afterwards* the select handler Ajax call finally finishes and puts in the record anyway.
    Conclusion: checkbox is unchecked, but the record is in my array anyway.

    How do I handle this in an elegant way? Is there some way to get a hold of the original Ajax call's status in the unselect handler?

    Thanks for any advice,

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    You can buffer event listeners so that the listener will only listen to one firing of that event for x number of milliseconds.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts