[CLOSED] Aborting Transactions

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Aborting Transactions

    Hi All,

    I have a slight issue with transactions. I have grid from which users can select rows. Once a user selects a row it fire off load requests to 3 store which populate with information about that row in a second grid. The problem I'm having is if the user quickly selects different rows, requests are fired off to the back end for each row selected and there is a possibility that the data being displayed in the second grid is not for the row the finally selects (due to network conditions, store size etc). What I was planning on doing and so far unable to do is if a new row is select whilst a request for previous row is still being processed abort the previous rows transactions and only load the currently selected row. I have tried auto-abort on the store but for some reason this aborts the wrong store. I'm just wondering if what I'm trying to do is possible? and how would I go about doing it?

    Thanks
    Last edited by Daniil; Nov 23, 2012 at 10:45 AM. Reason: [CLOSED]
  2. #2
    Hi @rbarr,

    What about to prevent selecting at all till a response comes to a browser?
  3. #3
    Hi Daniil

    Thanks for the quick reply, sadly this isn't really an option there are upwards of 50 items in the top grid and there is a requirement for the user to be able to move between rows smoothly, so stopping and waiting for the data to be returned would cause the user problems.
  4. #4
    What about to use Buffer option in listener/direct event (event is used by you to catch selection change)
    Buffer=1000
  5. #5
    Hi Vladimir,

    Thanks for the suggestion but sadly it didn't help with the issue.
  6. #6
    There is abort method.
    http://docs.sencha.com/ext-js/3-4/#!...n-method-abort

    But you need a request instance to call this method.
  7. #7
    Thanks for the info Daniil !

    I tried to use this piece of JavaScript, it uses store.proxt.activeRequest to get the request instance from the store which is var tran. The second method uses some rules to determined if the transaction is for the row your on, it almost working expect its terminating the wrong store transaction. Any ideas?

    var setLastTranscId = function (tran, store) {
    
        lastTransactionId = tran;
        if (typeof (store) != "undefined") {
            if (typeof (tran) != "undefined") {
                if (tran != false) {
                    var tranStoreArray = [];
                    tranStoreArray.push(tran);
                    tranStoreArray.push(store);
                    tranStoreArray.push(getAppValue());
                    tranStoreArray.push(false);
                    lastTransactionIds.push(tranStoreArray);
                }
            }
        }
    
        for (var i = 0; i < lastTransactionIds.length; i++) {
            if (lastTransactionIds[i][2] != getAppValue()) {
                lastTransactionIds[i][3] = true;
            }
        }
    
    }
    
    var killTransac = function () {
    
        for (var i = 0; i < lastTransactionIds.length; i++) {
            if (lastTransactionIds[i][2] != getAppValue()) {
                if (typeof (lastTransactionIds[i][0].read) != "undefined") {
                    if (lastTransactionIds[i][0].read.conn != null) {
                      if(lastTransactionIds[i][3]){
                       // Ext.Ajax.abort(lastTransactionIds[i][0].tran);
                        }
                    }
                } 
            }
    
        }
    
    }
  8. #8
    Quote Originally Posted by rbarr View Post
    it almost working expect its terminating the wrong store transaction. Any ideas?
    Please clarify is there a possibility that something is wrong in the logic of your functions? Or does the abort method of some request actually abort another one?
  9. #9
    Hi Daniil

    It appears the abort method is aborting the wrong transaction, sorry for the confusion.
  10. #10
    No problem, it is clear now.

    But, I am afraid, it is hard to say something concrete without a sample to reproduce.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Sep 17, 2009, 8:04 AM

Tags for this Thread

Posting Permissions