1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    1
    Vote Rating
    0
    jims is on a distinguished road

      0  

    Default JsonWriter issue

    JsonWriter issue


    Hello,

    Firstable I doesn't speak english very well so I apologize in advance.

    I try to make a grid panel with an add line button on tbar.
    When i click on this button extjs send to my server (POST METHOD) a json with parms like that :
    Code:
    {"idP":4,"items":[{"statut":"","pbjs":"000000","av_ap":"","description":"","jour":"2011-10-02T00:00:00","nbj":"1"}]}
    And my java server return
    Code:
    {"items":[{"id":2,"statut":"","description":"","av_ap":"","nbj":"1","jour":"02\/10\/2011","pbjs":"000000"}],"success":true}
    My problem is when i click on this button very fast :
    Extjs does not wait the server to finish the first request so it does not yet receive the success proprety.
    Then the second request is an array of items with the item of my first request and the item of my second request.
    The item of my fisrt request has been created but extjs does not wait for the success proprety and send item of my first request a second time on my second request.
    So the item of my first request is created twice...

    Here is an exemple :
    First request :
    Code:
    {{"idP":4,"items":[{"statut":"","pbjs":"000000","av_ap":"","description":"","jour":"2011-10-06T00:00:00","nbj":"1"}]}
    Second request :

    Code:
    {"idP":4,"items":[{"statut":"","pbjs":"000000","av_ap":"","description":"","jour":"2011-10-07T00:00:00","nbj":"1"},{"statut":"","pbjs":"000000","av_ap":"","description":"","jour":"2011-10-06T00:00:00","nbj":"1"}]}
    Does anybody have a solution ?

    Thanks ,

    Jims

    Edit :

    Problem solved with the store.commitChanges() method.

  2. #2
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    Not sure if I understood your problem correctly, but you need to know that ajax requests are asynchronous... you need to use a callback to make sure that you received the data before proceeding.

    E.g.

    Code:
    Ext.Ajax.request({
       ...
       success: function() { //handle success },
       failure: function() { //handle failure }
    });

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..."