Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    48
    Vote Rating
    0
    sistasi is on a distinguished road

      0  

    Default get json array from extjs.data.store

    get json array from extjs.data.store


    Hi,

    just wondering how to get the json array from the store?

    I want to retrieve the json array object outside the ajax request or store.

    i tried this but

    Code:
    var arr;
    var conn = new Ext.data.Connection();
        conn.request({
         url: listSurveyAttemptPath,
         params:{survey_id:1},
         success: createArray,
         failure: function() {
            Ext.Msg.alert('Status', 'Unable to show history at this time. Please try again later.');
    	 }
    	});
    function createArray(response) {
    		var obj = Ext.util.JSON.decode(response.responseText);  
    		arr = obj;  
    alert(arr); //<-- this works!
    	}
    alert(arr); //<-- this does not work!
    the arr object inside the function createArray is correct however i cannot access it outside the function.

    but i need to manipulate the arr outside the function.

    else how to get the json array from the Ext.data.store?

    how can i do this?
    any idea?

    Thanks..
    ~sista~

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,638
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Ajax requests are not synchronous.

    When you try to access it the second time, the ajax request has probably not completed.

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    48
    Vote Rating
    0
    sistasi is on a distinguished road

      0  

    Default


    so any idea how can i get the array itself from servlet?
    ~sista~

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Use the "<-- this works!" line!

  5. #5
    Ext User
    Join Date
    Jan 2008
    Posts
    48
    Vote Rating
    0
    sistasi is on a distinguished road

      0  

    Default


    but i need to use the arr values outside the ajax request. any idea? thanks
    ~sista~

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Call the "outside" function from the success handler.

    Ajax is asynchronous. You just have to pick up your processing after the data returns.

    You do get used to it!

  7. #7
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    888
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by sistasi View Post

    var obj = Ext.util.JSON.decode(response.responseText);
    arr = obj;

    }
    arr links to the internal obj which gets lost outside the function.
    Simply try

    PHP Code:
    arr Ext.util.JSON.decode(response.responseText); 
    Does it work now?

    Anyway alert(arr) will only work, as already said, _after_ the ajax request has been done.

Thread Participants: 3