1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    Alexei Ptitchkin is on a distinguished road

      0  

    Default Unanswered: How to Error message in store sync callback

    Unanswered: How to Error message in store sync callback


    To handle success or fail store.sync() I use to pass sync options with callbacks.

    Code:
    var syncOptions = {controller:this, 
                    record:record,
                    recordId:recordId,
                    dealerStore:dealerStore, 
                    wnd:wnd,
                    success:this.lookupDealerSyncCallback,
                    failure:this.failureSyncCallback};
            this.getDealersLookupStore().sync(syncOptions);
    On server side I always write json response to client using:

    Code:
            this.getResponse().setContentType("application/json;charset=UTF-8");
            this.getResponse().getWriter().write(json);
    then if sync() succeed within call back I can access response text via batch.operations[0].response.responseText

    Code:
        lookupDealerSyncCallback:function (batch, syncOptions){
            syncOptions.dealerStore.load();
            syncOptions.wnd.close();
    
            
            //batch.operations[0].response.responseText = "{"dealers":
            //        {"dealerCode":"BSDA","dealerName":"BUSINESS SOLUTIONS DIVISION,",
            //        "hasDefaultAllocation":"N","hasForecast":"Y","hasSellHand":"N",
            //        "hasQuota":"Y","createOn":"08/22/2012 13:29:09","createBy":"Eric Gu",
            //        "updateOn":"08/22/2012 13:29:09","updateBy":"Eric Gu",
            //        "ordinal":0,"id":283,"idx":0},"success": true }"
            
            var responseObj = Ext.JSON.decode(batch.operations[0].response.responseText,true);
            var newDealerId = responseObj.dealers.id;
            syncOptions.record.setId(newDealerId);
                syncOptions.controller.openDealerDetailWnd(null, syncOptions.record);
        },
    but if sync() fail batch.operations[0] does not have 'response' property and I don't have any message to show.

    Code:
        failureSyncCallback:function (batch, syncOptions){
                syncOptions.dealerStore.load();
            /*
             * here batch.operations[0] does not have 'response' property
             */
          },

    How I can get error message in failure callback?

    Thank you.

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    See my answer for the same question here: http://www.sencha.com/forum/showthre...re-listener...

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    Alexei Ptitchkin is on a distinguished road

      0  

    Default


    Quote Originally Posted by vietits View Post
    See my answer for the same question here: http://www.sencha.com/forum/showthre...re-listener...
    Thanks for response.
    My point was: - Why I can NOT see response in batch.operations[0]?

    As a way around I did "Message alert in store's exception listener" and silent failure recovery in "failureSyncCallback:function". But I really don't like to have such multistage error processing.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi